@gomomento/sdk-core 1.86.0 → 1.88.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/auth/credential-provider.d.ts +26 -0
- package/dist/src/auth/credential-provider.js +45 -7
- package/dist/src/errors/errors.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -1
- package/dist/src/internal/utils/auth.d.ts +7 -3
- package/dist/src/internal/utils/auth.js +19 -7
- package/dist/src/messages/responses/cache-batch-get.d.ts +18 -51
- package/dist/src/messages/responses/cache-batch-get.js +23 -56
- package/dist/src/messages/responses/cache-batch-set.d.ts +14 -51
- package/dist/src/messages/responses/cache-batch-set.js +12 -42
- package/dist/src/messages/responses/cache-delete.d.ts +11 -44
- package/dist/src/messages/responses/cache-delete.js +14 -35
- package/dist/src/messages/responses/cache-dictionary-fetch.d.ts +18 -54
- package/dist/src/messages/responses/cache-dictionary-fetch.js +23 -46
- package/dist/src/messages/responses/cache-dictionary-get-field.d.ts +19 -58
- package/dist/src/messages/responses/cache-dictionary-get-field.js +19 -52
- package/dist/src/messages/responses/cache-dictionary-get-fields.d.ts +19 -56
- package/dist/src/messages/responses/cache-dictionary-get-fields.js +27 -50
- package/dist/src/messages/responses/cache-dictionary-increment.d.ts +14 -46
- package/dist/src/messages/responses/cache-dictionary-increment.js +14 -41
- package/dist/src/messages/responses/cache-dictionary-length.d.ts +19 -53
- package/dist/src/messages/responses/cache-dictionary-length.js +26 -40
- package/dist/src/messages/responses/cache-dictionary-remove-field.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-remove-field.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-remove-fields.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-remove-fields.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-set-field.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-set-field.js +13 -34
- package/dist/src/messages/responses/cache-dictionary-set-fields.d.ts +10 -43
- package/dist/src/messages/responses/cache-dictionary-set-fields.js +13 -34
- package/dist/src/messages/responses/cache-flush.d.ts +12 -45
- package/dist/src/messages/responses/cache-flush.js +15 -36
- package/dist/src/messages/responses/cache-get.d.ts +19 -54
- package/dist/src/messages/responses/cache-get.js +22 -45
- package/dist/src/messages/responses/cache-increment.d.ts +24 -51
- package/dist/src/messages/responses/cache-increment.js +27 -49
- package/dist/src/messages/responses/cache-item-get-ttl.d.ts +22 -55
- package/dist/src/messages/responses/cache-item-get-ttl.js +27 -41
- package/dist/src/messages/responses/cache-item-get-type.d.ts +22 -55
- package/dist/src/messages/responses/cache-item-get-type.js +27 -41
- package/dist/src/messages/responses/cache-key-exists.d.ts +16 -47
- package/dist/src/messages/responses/cache-key-exists.js +17 -38
- package/dist/src/messages/responses/cache-keys-exist.d.ts +16 -47
- package/dist/src/messages/responses/cache-keys-exist.js +16 -37
- package/dist/src/messages/responses/cache-list-concatenate-back.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-concatenate-back.js +13 -37
- package/dist/src/messages/responses/cache-list-concatenate-front.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-concatenate-front.js +13 -37
- package/dist/src/messages/responses/cache-list-fetch.d.ts +23 -58
- package/dist/src/messages/responses/cache-list-fetch.js +26 -49
- package/dist/src/messages/responses/cache-list-length.d.ts +27 -59
- package/dist/src/messages/responses/cache-list-length.js +32 -42
- package/dist/src/messages/responses/cache-list-pop-back.d.ts +22 -57
- package/dist/src/messages/responses/cache-list-pop-back.js +25 -48
- package/dist/src/messages/responses/cache-list-pop-front.d.ts +22 -57
- package/dist/src/messages/responses/cache-list-pop-front.js +25 -48
- package/dist/src/messages/responses/cache-list-push-back.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-push-back.js +13 -37
- package/dist/src/messages/responses/cache-list-push-front.d.ts +13 -46
- package/dist/src/messages/responses/cache-list-push-front.js +13 -37
- package/dist/src/messages/responses/cache-list-remove-value.d.ts +11 -44
- package/dist/src/messages/responses/cache-list-remove-value.js +14 -35
- package/dist/src/messages/responses/cache-list-retain.d.ts +11 -44
- package/dist/src/messages/responses/cache-list-retain.js +14 -35
- package/dist/src/messages/responses/cache-set-add-element.d.ts +10 -53
- package/dist/src/messages/responses/cache-set-add-element.js +13 -34
- package/dist/src/messages/responses/cache-set-add-elements.d.ts +12 -45
- package/dist/src/messages/responses/cache-set-add-elements.js +17 -38
- package/dist/src/messages/responses/cache-set-fetch.d.ts +18 -54
- package/dist/src/messages/responses/cache-set-fetch.js +23 -46
- package/dist/src/messages/responses/cache-set-if-absent-or-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-absent-or-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-absent.d.ts +14 -63
- package/dist/src/messages/responses/cache-set-if-absent.js +20 -40
- package/dist/src/messages/responses/cache-set-if-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-not-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-not-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-not-exists.d.ts +14 -54
- package/dist/src/messages/responses/cache-set-if-not-exists.js +20 -40
- package/dist/src/messages/responses/cache-set-if-present-and-not-equal.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-present-and-not-equal.js +21 -41
- package/dist/src/messages/responses/cache-set-if-present.d.ts +15 -55
- package/dist/src/messages/responses/cache-set-if-present.js +21 -41
- package/dist/src/messages/responses/cache-set-remove-element.d.ts +10 -43
- package/dist/src/messages/responses/cache-set-remove-element.js +13 -34
- package/dist/src/messages/responses/cache-set-remove-elements.d.ts +13 -46
- package/dist/src/messages/responses/cache-set-remove-elements.js +13 -34
- package/dist/src/messages/responses/cache-set-sample.d.ts +18 -54
- package/dist/src/messages/responses/cache-set-sample.js +23 -46
- package/dist/src/messages/responses/cache-set.d.ts +10 -43
- package/dist/src/messages/responses/cache-set.js +13 -34
- package/dist/src/messages/responses/cache-sorted-set-fetch.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-get-score.d.ts +6 -1
- package/dist/src/messages/responses/cache-sorted-set-get-score.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-get-scores.js +1 -1
- package/dist/src/messages/responses/cache-sorted-set-increment-score.js +1 -1
- package/dist/src/messages/responses/cache-ttl-decrease.d.ts +19 -53
- package/dist/src/messages/responses/cache-ttl-decrease.js +29 -39
- package/dist/src/messages/responses/cache-ttl-increase.d.ts +19 -53
- package/dist/src/messages/responses/cache-ttl-increase.js +29 -39
- package/dist/src/messages/responses/cache-ttl-update.d.ts +15 -55
- package/dist/src/messages/responses/cache-ttl-update.js +21 -41
- package/dist/src/messages/responses/create-cache.d.ts +15 -58
- package/dist/src/messages/responses/create-cache.js +21 -39
- package/dist/src/messages/responses/delete-cache.d.ts +11 -44
- package/dist/src/messages/responses/delete-cache.js +14 -35
- package/dist/src/messages/responses/enums/auth/generate-api-key.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/generate-api-key.js +9 -0
- package/dist/src/messages/responses/enums/auth/generate-disposable-token.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/generate-disposable-token.js +9 -0
- package/dist/src/messages/responses/enums/auth/index.d.ts +3 -0
- package/dist/src/messages/responses/enums/auth/index.js +10 -0
- package/dist/src/messages/responses/enums/auth/refresh-api-key.d.ts +4 -0
- package/dist/src/messages/responses/enums/auth/refresh-api-key.js +9 -0
- package/dist/src/messages/responses/enums/cache/control/index.d.ts +17 -0
- package/dist/src/messages/responses/enums/cache/control/index.js +25 -0
- package/dist/src/messages/responses/enums/cache/dictionary/index.d.ts +40 -0
- package/dist/src/messages/responses/enums/cache/dictionary/index.js +53 -0
- package/dist/src/messages/responses/enums/cache/index.d.ts +5 -0
- package/dist/src/messages/responses/enums/cache/index.js +22 -0
- package/dist/src/messages/responses/enums/cache/list/index.d.ts +44 -0
- package/dist/src/messages/responses/enums/cache/list/index.js +58 -0
- package/dist/src/messages/responses/enums/cache/scalar/index.d.ts +95 -0
- package/dist/src/messages/responses/enums/cache/scalar/index.js +122 -0
- package/dist/src/messages/responses/enums/cache/set/index.d.ts +26 -0
- package/dist/src/messages/responses/enums/cache/set/index.js +36 -0
- package/dist/src/messages/responses/enums/index.d.ts +4 -0
- package/dist/src/messages/responses/enums/index.js +21 -0
- package/dist/src/messages/responses/enums/leaderboard/index.d.ts +20 -0
- package/dist/src/messages/responses/enums/leaderboard/index.js +29 -0
- package/dist/src/messages/responses/enums/topics/index.d.ts +8 -0
- package/dist/src/messages/responses/enums/topics/index.js +14 -0
- package/dist/src/messages/responses/generate-api-key.d.ts +10 -27
- package/dist/src/messages/responses/generate-api-key.js +10 -18
- package/dist/src/messages/responses/generate-disposable-token.d.ts +10 -27
- package/dist/src/messages/responses/generate-disposable-token.js +10 -18
- package/dist/src/messages/responses/leaderboard/leaderboard-delete.d.ts +10 -43
- package/dist/src/messages/responses/leaderboard/leaderboard-delete.js +13 -34
- package/dist/src/messages/responses/leaderboard/leaderboard-fetch.d.ts +12 -45
- package/dist/src/messages/responses/leaderboard/leaderboard-fetch.js +11 -35
- package/dist/src/messages/responses/leaderboard/leaderboard-length.d.ts +12 -45
- package/dist/src/messages/responses/leaderboard/leaderboard-length.js +11 -35
- package/dist/src/messages/responses/leaderboard/leaderboard-remove-elements.d.ts +10 -43
- package/dist/src/messages/responses/leaderboard/leaderboard-remove-elements.js +13 -34
- package/dist/src/messages/responses/leaderboard/leaderboard-upsert.d.ts +11 -44
- package/dist/src/messages/responses/leaderboard/leaderboard-upsert.js +14 -35
- package/dist/src/messages/responses/list-caches.d.ts +13 -46
- package/dist/src/messages/responses/list-caches.js +11 -35
- package/dist/src/messages/responses/refresh-api-key.d.ts +10 -27
- package/dist/src/messages/responses/refresh-api-key.js +10 -18
- package/dist/src/messages/responses/response-base.d.ts +20 -0
- package/dist/src/messages/responses/response-base.js +42 -2
- package/dist/src/messages/responses/topic-publish.d.ts +10 -43
- package/dist/src/messages/responses/topic-publish.js +13 -34
- package/dist/src/messages/responses/topic-subscribe.d.ts +10 -37
- package/dist/src/messages/responses/topic-subscribe.js +10 -33
- package/dist/src/messages/responses/webhook/put-webhook.d.ts +1 -10
- package/package.json +1 -1
@@ -1,74 +1,38 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
2
|
+
import { BaseResponseError, BaseResponseMiss, ResponseBase } from './response-base';
|
3
|
+
import { CacheListLengthResponse } from './enums';
|
4
|
+
interface IResponse {
|
5
|
+
value(): number | undefined;
|
6
|
+
readonly type: CacheListLengthResponse;
|
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 CacheListLength.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheListLength.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 list was successfully retrieved from the cache.
|
10
|
+
* Provides `value` and `length` accessors to retrieve the length of the list.
|
22
11
|
*/
|
23
|
-
export declare
|
24
|
-
|
25
|
-
declare class _Hit extends Response {
|
12
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
13
|
+
readonly type: CacheListLengthResponse.Hit;
|
26
14
|
private readonly _length;
|
27
15
|
constructor(length: number);
|
28
16
|
/**
|
29
|
-
* Returns the length of the list
|
30
|
-
* @returns
|
17
|
+
* Returns the length of the list.
|
18
|
+
* @returns number
|
19
|
+
*/
|
20
|
+
value(): number;
|
21
|
+
/**
|
22
|
+
* Returns the length of the list.
|
23
|
+
* @returns number
|
31
24
|
*/
|
32
25
|
length(): number;
|
33
26
|
toString(): string;
|
34
27
|
}
|
35
|
-
declare const Hit_base: {
|
36
|
-
new (...args: any[]): {};
|
37
|
-
} & typeof _Hit;
|
38
28
|
/**
|
39
|
-
* Indicates that the requested
|
40
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
29
|
+
* Indicates that the requested list was not available in the cache.
|
41
30
|
*/
|
42
|
-
export declare class
|
43
|
-
|
44
|
-
|
31
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
32
|
+
readonly type: CacheListLengthResponse.Miss;
|
33
|
+
constructor();
|
34
|
+
value(): undefined;
|
45
35
|
}
|
46
|
-
declare const Miss_base: {
|
47
|
-
new (...args: any[]): {
|
48
|
-
readonly is_miss: boolean;
|
49
|
-
};
|
50
|
-
} & typeof _Miss;
|
51
|
-
/**
|
52
|
-
* Indicates that the requested data was not available in the cache.
|
53
|
-
*/
|
54
|
-
export declare class Miss extends Miss_base {
|
55
|
-
}
|
56
|
-
declare class _Error extends Response {
|
57
|
-
protected _innerException: SdkError;
|
58
|
-
constructor(_innerException: SdkError);
|
59
|
-
}
|
60
|
-
declare const Error_base: {
|
61
|
-
new (...args: any[]): {
|
62
|
-
_innerException: SdkError; /**
|
63
|
-
* Returns the length of the list
|
64
|
-
* @returns {number}
|
65
|
-
*/
|
66
|
-
message(): string;
|
67
|
-
innerException(): SdkError;
|
68
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
69
|
-
toString(): string;
|
70
|
-
};
|
71
|
-
} & typeof _Error;
|
72
36
|
/**
|
73
37
|
* Indicates that an error occurred during the list length request.
|
74
38
|
*
|
@@ -79,6 +43,10 @@ declare const Error_base: {
|
|
79
43
|
* - `message()` - a human-readable description of the error
|
80
44
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
81
45
|
*/
|
82
|
-
export declare class Error extends
|
46
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
47
|
+
readonly type: CacheListLengthResponse.Error;
|
48
|
+
constructor(_innerException: SdkError);
|
49
|
+
value(): undefined;
|
83
50
|
}
|
51
|
+
export type Response = Hit | Miss | Error;
|
84
52
|
export {};
|
@@ -1,38 +1,28 @@
|
|
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 CacheListLength.Error) {
|
19
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
-
* // `CacheListLength.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 list was successfully retrieved from the cache.
|
8
|
+
* Provides `value` and `length` accessors to retrieve the length of the list.
|
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(length) {
|
30
12
|
super();
|
13
|
+
this.type = enums_1.CacheListLengthResponse.Hit;
|
31
14
|
this._length = length;
|
32
15
|
}
|
33
16
|
/**
|
34
|
-
* Returns the length of the list
|
35
|
-
* @returns
|
17
|
+
* Returns the length of the list.
|
18
|
+
* @returns number
|
19
|
+
*/
|
20
|
+
value() {
|
21
|
+
return this._length;
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Returns the length of the list.
|
25
|
+
* @returns number
|
36
26
|
*/
|
37
27
|
length() {
|
38
28
|
return this._length;
|
@@ -41,27 +31,20 @@ class _Hit extends Response {
|
|
41
31
|
return `${super.toString()}: length ${this._length}`;
|
42
32
|
}
|
43
33
|
}
|
44
|
-
/**
|
45
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
46
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
47
|
-
*/
|
48
|
-
class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
|
49
|
-
}
|
50
34
|
exports.Hit = Hit;
|
51
|
-
class _Miss extends Response {
|
52
|
-
}
|
53
35
|
/**
|
54
|
-
* Indicates that the requested
|
36
|
+
* Indicates that the requested list was not available in the cache.
|
55
37
|
*/
|
56
|
-
class Miss extends
|
57
|
-
|
58
|
-
exports.Miss = Miss;
|
59
|
-
class _Error extends Response {
|
60
|
-
constructor(_innerException) {
|
38
|
+
class Miss extends response_base_1.BaseResponseMiss {
|
39
|
+
constructor() {
|
61
40
|
super();
|
62
|
-
this.
|
41
|
+
this.type = enums_1.CacheListLengthResponse.Miss;
|
42
|
+
}
|
43
|
+
value() {
|
44
|
+
return undefined;
|
63
45
|
}
|
64
46
|
}
|
47
|
+
exports.Miss = Miss;
|
65
48
|
/**
|
66
49
|
* Indicates that an error occurred during the list length request.
|
67
50
|
*
|
@@ -72,7 +55,14 @@ class _Error extends Response {
|
|
72
55
|
* - `message()` - a human-readable description of the error
|
73
56
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
74
57
|
*/
|
75
|
-
class Error extends
|
58
|
+
class Error extends response_base_1.BaseResponseError {
|
59
|
+
constructor(_innerException) {
|
60
|
+
super(_innerException);
|
61
|
+
this.type = enums_1.CacheListLengthResponse.Error;
|
62
|
+
}
|
63
|
+
value() {
|
64
|
+
return undefined;
|
65
|
+
}
|
76
66
|
}
|
77
67
|
exports.Error = Error;
|
78
|
-
//# sourceMappingURL=data:application/json;base64,
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtbGlzdC1sZW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kError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
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 CacheListPopBack.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheListPopBack.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 {
|
2
|
+
import { BaseResponseError, BaseResponseMiss, ResponseBase } from './response-base';
|
3
|
+
import { CacheListPopBackResponse } from './enums';
|
4
|
+
interface IResponse {
|
24
5
|
value(): string | undefined;
|
6
|
+
readonly type: CacheListPopBackResponse;
|
25
7
|
}
|
26
|
-
|
8
|
+
/**
|
9
|
+
* Indicates a successful list pop back request.
|
10
|
+
* Provides `value*` accessors to retrieve the data in the appropriate format.
|
11
|
+
*/
|
12
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
13
|
+
readonly type: CacheListPopBackResponse.Hit;
|
27
14
|
private readonly body;
|
28
15
|
constructor(body: Uint8Array);
|
29
16
|
/**
|
30
17
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
31
18
|
* @returns string
|
32
19
|
*/
|
33
|
-
|
20
|
+
value(): string;
|
34
21
|
/**
|
35
22
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
36
23
|
* @returns string
|
37
24
|
*/
|
38
|
-
|
25
|
+
valueString(): string;
|
39
26
|
/**
|
40
27
|
* Returns the data as a byte array.
|
41
28
|
* @returns {Uint8Array}
|
@@ -43,40 +30,14 @@ declare class _Hit extends Response {
|
|
43
30
|
valueUint8Array(): Uint8Array;
|
44
31
|
toString(): string;
|
45
32
|
}
|
46
|
-
declare const Hit_base: {
|
47
|
-
new (...args: any[]): {};
|
48
|
-
} & typeof _Hit;
|
49
|
-
/**
|
50
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
51
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
52
|
-
*/
|
53
|
-
export declare class Hit extends Hit_base {
|
54
|
-
}
|
55
|
-
declare class _Miss extends Response {
|
56
|
-
}
|
57
|
-
declare const Miss_base: {
|
58
|
-
new (...args: any[]): {
|
59
|
-
readonly is_miss: boolean;
|
60
|
-
};
|
61
|
-
} & typeof _Miss;
|
62
33
|
/**
|
63
|
-
* Indicates that the requested
|
34
|
+
* Indicates that the requested list was not available in the cache.
|
64
35
|
*/
|
65
|
-
export declare class Miss extends
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
constructor(_innerException: SdkError);
|
36
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
37
|
+
readonly type: CacheListPopBackResponse.Miss;
|
38
|
+
constructor();
|
39
|
+
value(): undefined;
|
70
40
|
}
|
71
|
-
declare const Error_base: {
|
72
|
-
new (...args: any[]): {
|
73
|
-
_innerException: SdkError;
|
74
|
-
message(): string;
|
75
|
-
innerException(): SdkError;
|
76
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
77
|
-
toString(): string;
|
78
|
-
};
|
79
|
-
} & typeof _Error;
|
80
41
|
/**
|
81
42
|
* Indicates that an error occurred during the list pop back request.
|
82
43
|
*
|
@@ -87,6 +48,10 @@ declare const Error_base: {
|
|
87
48
|
* - `message()` - a human-readable description of the error
|
88
49
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
89
50
|
*/
|
90
|
-
export declare class Error extends
|
51
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
52
|
+
readonly type: CacheListPopBackResponse.Error;
|
53
|
+
constructor(_innerException: SdkError);
|
54
|
+
value(): undefined;
|
91
55
|
}
|
56
|
+
export type Response = Hit | Miss | Error;
|
92
57
|
export {};
|
@@ -1,55 +1,32 @@
|
|
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
5
|
const utils_1 = require("../../internal/utils");
|
6
|
+
const enums_1 = require("./enums");
|
6
7
|
const TEXT_DECODER = new TextDecoder();
|
7
8
|
/**
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* the following subtypes:
|
11
|
-
*
|
12
|
-
* - {Hit}
|
13
|
-
* - {Miss}
|
14
|
-
* - {Error}
|
15
|
-
*
|
16
|
-
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
17
|
-
* @example
|
18
|
-
* For example:
|
19
|
-
* ```
|
20
|
-
* if (response instanceof CacheListPopBack.Error) {
|
21
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
22
|
-
* // `CacheListPopBack.Error` in this block, so you will have access to the properties
|
23
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
24
|
-
* }
|
25
|
-
* ```
|
9
|
+
* Indicates a successful list pop back request.
|
10
|
+
* Provides `value*` accessors to retrieve the data in the appropriate format.
|
26
11
|
*/
|
27
|
-
class
|
28
|
-
value() {
|
29
|
-
if (this instanceof Hit) {
|
30
|
-
return this.value();
|
31
|
-
}
|
32
|
-
return undefined;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
exports.Response = Response;
|
36
|
-
class _Hit extends Response {
|
12
|
+
class Hit extends response_base_1.ResponseBase {
|
37
13
|
constructor(body) {
|
38
14
|
super();
|
15
|
+
this.type = enums_1.CacheListPopBackResponse.Hit;
|
39
16
|
this.body = body;
|
40
17
|
}
|
41
18
|
/**
|
42
19
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
43
20
|
* @returns string
|
44
21
|
*/
|
45
|
-
|
22
|
+
value() {
|
46
23
|
return TEXT_DECODER.decode(this.body);
|
47
24
|
}
|
48
25
|
/**
|
49
26
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
50
27
|
* @returns string
|
51
28
|
*/
|
52
|
-
|
29
|
+
valueString() {
|
53
30
|
return TEXT_DECODER.decode(this.body);
|
54
31
|
}
|
55
32
|
/**
|
@@ -64,27 +41,20 @@ class _Hit extends Response {
|
|
64
41
|
return `${super.toString()}: ${display}`;
|
65
42
|
}
|
66
43
|
}
|
67
|
-
/**
|
68
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
69
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
70
|
-
*/
|
71
|
-
class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
|
72
|
-
}
|
73
44
|
exports.Hit = Hit;
|
74
|
-
class _Miss extends Response {
|
75
|
-
}
|
76
45
|
/**
|
77
|
-
* Indicates that the requested
|
46
|
+
* Indicates that the requested list was not available in the cache.
|
78
47
|
*/
|
79
|
-
class Miss extends
|
80
|
-
|
81
|
-
exports.Miss = Miss;
|
82
|
-
class _Error extends Response {
|
83
|
-
constructor(_innerException) {
|
48
|
+
class Miss extends response_base_1.BaseResponseMiss {
|
49
|
+
constructor() {
|
84
50
|
super();
|
85
|
-
this.
|
51
|
+
this.type = enums_1.CacheListPopBackResponse.Miss;
|
52
|
+
}
|
53
|
+
value() {
|
54
|
+
return undefined;
|
86
55
|
}
|
87
56
|
}
|
57
|
+
exports.Miss = Miss;
|
88
58
|
/**
|
89
59
|
* Indicates that an error occurred during the list pop back request.
|
90
60
|
*
|
@@ -95,7 +65,14 @@ class _Error extends Response {
|
|
95
65
|
* - `message()` - a human-readable description of the error
|
96
66
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
97
67
|
*/
|
98
|
-
class Error extends
|
68
|
+
class Error extends response_base_1.BaseResponseError {
|
69
|
+
constructor(_innerException) {
|
70
|
+
super(_innerException);
|
71
|
+
this.type = enums_1.CacheListPopBackResponse.Error;
|
72
|
+
}
|
73
|
+
value() {
|
74
|
+
return undefined;
|
75
|
+
}
|
99
76
|
}
|
100
77
|
exports.Error = Error;
|
101
|
-
//# sourceMappingURL=data:application/json;base64,
|
78
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtbGlzdC1wb3AtYmFjay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvY2FjaGUtbGlzdC1wb3AtYmFjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtREFJeUI7QUFDekIsZ0RBQW9EO0FBQ3BELG1DQUFpRDtBQUVqRCxNQUFNLFlBQVksR0FBRyxJQUFJLFdBQVcsRUFBRSxDQUFDO0FBT3ZDOzs7R0FHRztBQUNILE1BQWEsR0FBSSxTQUFRLDRCQUFZO0lBSW5DLFlBQVksSUFBZ0I7UUFDMUIsS0FBSyxFQUFFLENBQUM7UUFKRCxTQUFJLEdBQWlDLGdDQUF3QixDQUFDLEdBQUcsQ0FBQztRQUt6RSxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQztJQUNuQixDQUFDO0lBRUQ7OztPQUdHO0lBQ0ksS0FBSztRQUNWLE9BQU8sWUFBWSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDeEMsQ0FBQztJQUVEOzs7T0FHRztJQUNJLFdBQVc7UUFDaEIsT0FBTyxZQUFZLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN4QyxDQUFDO0lBRUQ7OztPQUdHO0lBQ0ksZUFBZTtRQUNwQixPQUFPLElBQUksQ0FBQyxJQUFJLENBQUM7SUFDbkIsQ0FBQztJQUVlLFFBQVE7UUFDdEIsTUFBTSxPQUFPLEdBQUcsSUFBQSxzQk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Y2sgcmVxdWVzdC5cbiAqXG4gKiBUaGlzIHJlc3BvbnNlIG9iamVjdCBpbmNsdWRlcyB0aGUgZm9sbG93aW5nIGZpZWxkcyB0aGF0IHlvdSBjYW4gdXNlIHRvIGRldGVybWluZVxuICogaG93IHlvdSB3b3VsZCBsaWtlIHRvIGhhbmRsZSB0aGUgZXJyb3I6XG4gKlxuICogLSBgZXJyb3JDb2RlKClgIC0gYSB1bmlxdWUgTW9tZW50byBlcnJvciBjb2RlIGluZGljYXRpbmcgdGhlIHR5cGUgb2YgZXJyb3IgdGhhdCBvY2N1cnJlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIEJhc2VSZXNwb25zZUVycm9yIGltcGxlbWVudHMgSVJlc3BvbnNlIHtcbiAgcmVhZG9ubHkgdHlwZTogQ2FjaGVMaXN0UG9wQmFja1Jlc3BvbnNlLkVycm9yID1cbiAgICBDYWNoZUxpc3RQb3BCYWNrUmVzcG9uc2UuRXJyb3I7XG4gIGNvbnN0cnVjdG9yKF9pbm5lckV4Y2VwdGlvbjogU2RrRXJyb3IpIHtcbiAgICBzdXBlcihfaW5uZXJFeGNlcHRpb24pO1xuICB9XG5cbiAgdmFsdWUoKTogdW5kZWZpbmVkIHtcbiAgICByZXR1cm4gdW5kZWZpbmVkO1xuICB9XG59XG5cbmV4cG9ydCB0eXBlIFJlc3BvbnNlID0gSGl0IHwgTWlzcyB8IEVycm9yO1xuIl19
|
@@ -1,41 +1,28 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
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 CacheListPopFront.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheListPopFront.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 {
|
2
|
+
import { BaseResponseError, BaseResponseMiss, ResponseBase } from './response-base';
|
3
|
+
import { CacheListPopFrontResponse } from './enums';
|
4
|
+
interface IResponse {
|
24
5
|
value(): string | undefined;
|
6
|
+
readonly type: CacheListPopFrontResponse;
|
25
7
|
}
|
26
|
-
|
8
|
+
/**
|
9
|
+
* Indicates a successful list pop front request.
|
10
|
+
* Provides `value*` accessors to retrieve the data in the appropriate format.
|
11
|
+
*/
|
12
|
+
export declare class Hit extends ResponseBase implements IResponse {
|
13
|
+
readonly type: CacheListPopFrontResponse.Hit;
|
27
14
|
private readonly body;
|
28
15
|
constructor(body: Uint8Array);
|
29
16
|
/**
|
30
17
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
31
18
|
* @returns string
|
32
19
|
*/
|
33
|
-
|
20
|
+
value(): string;
|
34
21
|
/**
|
35
22
|
* Returns the data as a utf-8 string, decoded from the underlying byte array.
|
36
23
|
* @returns string
|
37
24
|
*/
|
38
|
-
|
25
|
+
valueString(): string;
|
39
26
|
/**
|
40
27
|
* Returns the data as a byte array.
|
41
28
|
* @returns {Uint8Array}
|
@@ -43,40 +30,14 @@ declare class _Hit extends Response {
|
|
43
30
|
valueUint8Array(): Uint8Array;
|
44
31
|
toString(): string;
|
45
32
|
}
|
46
|
-
declare const Hit_base: {
|
47
|
-
new (...args: any[]): {};
|
48
|
-
} & typeof _Hit;
|
49
|
-
/**
|
50
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
51
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
52
|
-
*/
|
53
|
-
export declare class Hit extends Hit_base {
|
54
|
-
}
|
55
|
-
declare class _Miss extends Response {
|
56
|
-
}
|
57
|
-
declare const Miss_base: {
|
58
|
-
new (...args: any[]): {
|
59
|
-
readonly is_miss: boolean;
|
60
|
-
};
|
61
|
-
} & typeof _Miss;
|
62
33
|
/**
|
63
|
-
* Indicates that the requested
|
34
|
+
* Indicates that the requested list was not available in the cache.
|
64
35
|
*/
|
65
|
-
export declare class Miss extends
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
constructor(_innerException: SdkError);
|
36
|
+
export declare class Miss extends BaseResponseMiss implements IResponse {
|
37
|
+
readonly type: CacheListPopFrontResponse.Miss;
|
38
|
+
constructor();
|
39
|
+
value(): undefined;
|
70
40
|
}
|
71
|
-
declare const Error_base: {
|
72
|
-
new (...args: any[]): {
|
73
|
-
_innerException: SdkError;
|
74
|
-
message(): string;
|
75
|
-
innerException(): SdkError;
|
76
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
77
|
-
toString(): string;
|
78
|
-
};
|
79
|
-
} & typeof _Error;
|
80
41
|
/**
|
81
42
|
* Indicates that an error occurred during the list pop front request.
|
82
43
|
*
|
@@ -87,6 +48,10 @@ declare const Error_base: {
|
|
87
48
|
* - `message()` - a human-readable description of the error
|
88
49
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
89
50
|
*/
|
90
|
-
export declare class Error extends
|
51
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
52
|
+
readonly type: CacheListPopFrontResponse.Error;
|
53
|
+
constructor(_innerException: SdkError);
|
54
|
+
value(): undefined;
|
91
55
|
}
|
56
|
+
export type Response = Hit | Miss | Error;
|
92
57
|
export {};
|