@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,41 +1,18 @@
|
|
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 CacheSetFetch.Error) {
|
21
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
22
|
-
* // `CacheSetFetch.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 that the requested data was successfully retrieved from the cache. Provides
|
10
|
+
* `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(elements) {
|
38
14
|
super();
|
15
|
+
this.type = enums_1.CacheSetFetchResponse.Hit;
|
39
16
|
this.elements = elements;
|
40
17
|
}
|
41
18
|
/**
|
@@ -99,27 +76,20 @@ class _Hit extends Response {
|
|
99
76
|
return `${super.toString()}: [${truncatedStringArray.toString()}]`;
|
100
77
|
}
|
101
78
|
}
|
102
|
-
/**
|
103
|
-
* Indicates that the requested data was successfully retrieved from the cache. Provides
|
104
|
-
* `value*` accessors to retrieve the data in the appropriate format.
|
105
|
-
*/
|
106
|
-
class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
|
107
|
-
}
|
108
79
|
exports.Hit = Hit;
|
109
|
-
class _Miss extends Response {
|
110
|
-
}
|
111
80
|
/**
|
112
81
|
* Indicates that the requested data was not available in the cache.
|
113
82
|
*/
|
114
|
-
class Miss extends
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
83
|
+
class Miss extends response_base_1.BaseResponseMiss {
|
84
|
+
constructor() {
|
85
|
+
super(...arguments);
|
86
|
+
this.type = enums_1.CacheSetFetchResponse.Miss;
|
87
|
+
}
|
88
|
+
value() {
|
89
|
+
return undefined;
|
121
90
|
}
|
122
91
|
}
|
92
|
+
exports.Miss = Miss;
|
123
93
|
/**
|
124
94
|
* Indicates that an error occurred during the set fetch request.
|
125
95
|
*
|
@@ -130,7 +100,14 @@ class _Error extends Response {
|
|
130
100
|
* - `message()` - a human-readable description of the error
|
131
101
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
132
102
|
*/
|
133
|
-
class Error extends
|
103
|
+
class Error extends response_base_1.BaseResponseError {
|
104
|
+
constructor(_innerException) {
|
105
|
+
super(_innerException);
|
106
|
+
this.type = enums_1.CacheSetFetchResponse.Error;
|
107
|
+
}
|
108
|
+
value() {
|
109
|
+
return undefined;
|
110
|
+
}
|
134
111
|
}
|
135
112
|
exports.Error = Error;
|
136
|
-
//# sourceMappingURL=data:application/json;base64,
|
113
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtc2V0LWZldGNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJj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yBFcnJvciBleHRlbmRzIEJhc2VSZXNwb25zZUVycm9yIGltcGxlbWVudHMgSVJlc3BvbnNlIHtcbiAgY29uc3RydWN0b3IoX2lubmVyRXhjZXB0aW9uOiBTZGtFcnJvcikge1xuICAgIHN1cGVyKF9pbm5lckV4Y2VwdGlvbik7XG4gIH1cblxuICByZWFkb25seSB0eXBlOiBDYWNoZVNldEZldGNoUmVzcG9uc2UuRXJyb3IgPSBDYWNoZVNldEZldGNoUmVzcG9uc2UuRXJyb3I7XG4gIHB1YmxpYyB2YWx1ZSgpOiB1bmRlZmluZWQge1xuICAgIHJldHVybiB1bmRlZmluZWQ7XG4gIH1cbn1cblxuZXhwb3J0IHR5cGUgUmVzcG9uc2UgPSBIaXQgfCBNaXNzIHwgRXJyb3I7XG4iXX0=
|
@@ -1,66 +1,23 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Stored}
|
9
|
-
* - {NotStored}
|
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 CacheSetIfAbsentOrEqual.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheSetIfAbsentOrEqual.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 {
|
24
|
-
}
|
25
|
-
declare class _Stored extends Response {
|
2
|
+
import { BaseResponseError, ResponseBase } from './response-base';
|
3
|
+
import { CacheSetIfAbsentOrEqualResponse } from './enums';
|
4
|
+
interface IResponse {
|
5
|
+
readonly type: CacheSetIfAbsentOrEqualResponse;
|
26
6
|
}
|
27
|
-
declare const Stored_base: {
|
28
|
-
new (...args: any[]): {
|
29
|
-
readonly is_success: boolean;
|
30
|
-
};
|
31
|
-
} & typeof _Stored;
|
32
7
|
/**
|
33
|
-
* Indicates the key did not exist
|
8
|
+
* Indicates the new value was set because the key did not exist or the existing item was equal to the supplied `equal` value.
|
34
9
|
*/
|
35
|
-
export declare class Stored extends
|
10
|
+
export declare class Stored extends ResponseBase implements IResponse {
|
11
|
+
readonly type: CacheSetIfAbsentOrEqualResponse.Stored;
|
36
12
|
}
|
37
|
-
declare class _NotStored extends Response {
|
38
|
-
}
|
39
|
-
declare const NotStored_base: {
|
40
|
-
new (...args: any[]): {
|
41
|
-
readonly is_success: boolean;
|
42
|
-
};
|
43
|
-
} & typeof _NotStored;
|
44
13
|
/**
|
45
|
-
* Indicates
|
14
|
+
* Indicates that no value was set because the existing item was not equal to the supplied `equal` value.
|
46
15
|
*/
|
47
|
-
export declare class NotStored extends
|
48
|
-
|
49
|
-
declare class _Error extends Response {
|
50
|
-
protected _innerException: SdkError;
|
51
|
-
constructor(_innerException: SdkError);
|
16
|
+
export declare class NotStored extends ResponseBase implements IResponse {
|
17
|
+
readonly type: CacheSetIfAbsentOrEqualResponse.NotStored;
|
52
18
|
}
|
53
|
-
declare const Error_base: {
|
54
|
-
new (...args: any[]): {
|
55
|
-
_innerException: SdkError;
|
56
|
-
message(): string;
|
57
|
-
innerException(): SdkError;
|
58
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
59
|
-
toString(): string;
|
60
|
-
};
|
61
|
-
} & typeof _Error;
|
62
19
|
/**
|
63
|
-
* Indicates that an error occurred during the
|
20
|
+
* Indicates that an error occurred during the setIfAbsentOrEqual request.
|
64
21
|
*
|
65
22
|
* This response object includes the following fields that you can use to determine
|
66
23
|
* how you would like to handle the error:
|
@@ -69,6 +26,9 @@ declare const Error_base: {
|
|
69
26
|
* - `message()` - a human-readable description of the error
|
70
27
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
71
28
|
*/
|
72
|
-
export declare class Error extends
|
29
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
30
|
+
constructor(_innerException: SdkError);
|
31
|
+
readonly type: CacheSetIfAbsentOrEqualResponse.Error;
|
73
32
|
}
|
33
|
+
export type Response = Stored | NotStored | Error;
|
74
34
|
export {};
|
@@ -1,54 +1,30 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.NotStored = exports.Stored =
|
3
|
+
exports.Error = exports.NotStored = exports.Stored = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
+
const enums_1 = require("./enums");
|
5
6
|
/**
|
6
|
-
*
|
7
|
-
* response object is resolved to a type-safe object of one of
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Stored}
|
11
|
-
* - {NotStored}
|
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 CacheSetIfAbsentOrEqual.Error) {
|
19
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
-
* // `CacheSetIfAbsentOrEqual.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 the new value was set because the key did not exist or the existing item was equal to the supplied `equal` value.
|
24
8
|
*/
|
25
|
-
class
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}
|
30
|
-
/**
|
31
|
-
* Indicates the key did not exist and the value was set.
|
32
|
-
*/
|
33
|
-
class Stored extends (0, response_base_1.ResponseSuccess)(_Stored) {
|
9
|
+
class Stored extends response_base_1.ResponseBase {
|
10
|
+
constructor() {
|
11
|
+
super(...arguments);
|
12
|
+
this.type = enums_1.CacheSetIfAbsentOrEqualResponse.Stored;
|
13
|
+
}
|
34
14
|
}
|
35
15
|
exports.Stored = Stored;
|
36
|
-
class _NotStored extends Response {
|
37
|
-
}
|
38
16
|
/**
|
39
|
-
* Indicates
|
17
|
+
* Indicates that no value was set because the existing item was not equal to the supplied `equal` value.
|
40
18
|
*/
|
41
|
-
class NotStored extends
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
constructor(_innerException) {
|
46
|
-
super();
|
47
|
-
this._innerException = _innerException;
|
19
|
+
class NotStored extends response_base_1.ResponseBase {
|
20
|
+
constructor() {
|
21
|
+
super(...arguments);
|
22
|
+
this.type = enums_1.CacheSetIfAbsentOrEqualResponse.NotStored;
|
48
23
|
}
|
49
24
|
}
|
25
|
+
exports.NotStored = NotStored;
|
50
26
|
/**
|
51
|
-
* Indicates that an error occurred during the
|
27
|
+
* Indicates that an error occurred during the setIfAbsentOrEqual request.
|
52
28
|
*
|
53
29
|
* This response object includes the following fields that you can use to determine
|
54
30
|
* how you would like to handle the error:
|
@@ -57,7 +33,11 @@ class _Error extends Response {
|
|
57
33
|
* - `message()` - a human-readable description of the error
|
58
34
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
59
35
|
*/
|
60
|
-
class Error extends
|
36
|
+
class Error extends response_base_1.BaseResponseError {
|
37
|
+
constructor(_innerException) {
|
38
|
+
super(_innerException);
|
39
|
+
this.type = enums_1.CacheSetIfAbsentOrEqualResponse.Error;
|
40
|
+
}
|
61
41
|
}
|
62
42
|
exports.Error = Error;
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtc2V0LWlmLWFic2VudC1vci1lcXVhbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvY2FjaGUtc2V0LWlmLWFic2VudC1vci1lcXVhbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoi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NzYWdlKClgIC0gYSBodW1hbi1yZWFkYWJsZSBkZXNjcmlwdGlvbiBvZiB0aGUgZXJyb3JcbiAqIC0gYGlubmVyRXhjZXB0aW9uKClgIC0gdGhlIG9yaWdpbmFsIGVycm9yIHRoYXQgY2F1c2VkIHRoZSBmYWlsdXJlOyBjYW4gYmUgcmUtdGhyb3duLlxuICovXG5leHBvcnQgY2xhc3MgRXJyb3IgZXh0ZW5kcyBCYXNlUmVzcG9uc2VFcnJvciBpbXBsZW1lbnRzIElSZXNwb25zZSB7XG4gIGNvbnN0cnVjdG9yKF9pbm5lckV4Y2VwdGlvbjogU2RrRXJyb3IpIHtcbiAgICBzdXBlcihfaW5uZXJFeGNlcHRpb24pO1xuICB9XG5cbiAgcmVhZG9ubHkgdHlwZTogQ2FjaGVTZXRJZkFic2VudE9yRXF1YWxSZXNwb25zZS5FcnJvciA9XG4gICAgQ2FjaGVTZXRJZkFic2VudE9yRXF1YWxSZXNwb25zZS5FcnJvcjtcbn1cblxuZXhwb3J0IHR5cGUgUmVzcG9uc2UgPSBTdG9yZWQgfCBOb3RTdG9yZWQgfCBFcnJvcjtcbiJdfQ==
|
@@ -1,75 +1,23 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Stored}
|
9
|
-
* - {NotStored}
|
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 CacheSetIfAbsent.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheSetIfAbsent.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 {
|
24
|
-
}
|
25
|
-
declare class _Stored extends Response {
|
2
|
+
import { BaseResponseError, ResponseBase } from './response-base';
|
3
|
+
import { CacheSetIfAbsentResponse } from './enums';
|
4
|
+
interface IResponse {
|
5
|
+
readonly type: CacheSetIfAbsentResponse;
|
26
6
|
}
|
27
|
-
declare const Stored_base: {
|
28
|
-
new (...args: any[]): {
|
29
|
-
readonly is_success: boolean;
|
30
|
-
};
|
31
|
-
} & typeof _Stored;
|
32
7
|
/**
|
33
8
|
* Indicates the key did not exist and the value was set.
|
34
9
|
*/
|
35
|
-
export declare class Stored extends
|
10
|
+
export declare class Stored extends ResponseBase implements IResponse {
|
11
|
+
readonly type: CacheSetIfAbsentResponse.Stored;
|
36
12
|
}
|
37
|
-
declare class _NotStored extends Response {
|
38
|
-
}
|
39
|
-
declare const NotStored_base: {
|
40
|
-
new (...args: any[]): {
|
41
|
-
readonly is_success: boolean;
|
42
|
-
};
|
43
|
-
} & typeof _NotStored;
|
44
13
|
/**
|
45
|
-
* Indicates the key
|
14
|
+
* Indicates the key already exists and no value was set.
|
46
15
|
*/
|
47
|
-
export declare class NotStored extends
|
48
|
-
|
49
|
-
declare class _Error extends Response {
|
50
|
-
protected _innerException: SdkError;
|
51
|
-
constructor(_innerException: SdkError);
|
16
|
+
export declare class NotStored extends ResponseBase implements IResponse {
|
17
|
+
readonly type: CacheSetIfAbsentResponse.NotStored;
|
52
18
|
}
|
53
|
-
declare const Error_base: {
|
54
|
-
new (...args: any[]): {
|
55
|
-
_innerException: SdkError;
|
56
|
-
message(): string;
|
57
|
-
innerException(): SdkError;
|
58
|
-
errorCode(): import("../../errors").MomentoErrorCode; /**
|
59
|
-
* Indicates that an error occurred during the cache setIfAbsent request.
|
60
|
-
*
|
61
|
-
* This response object includes the following fields that you can use to determine
|
62
|
-
* how you would like to handle the error:
|
63
|
-
*
|
64
|
-
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
65
|
-
* - `message()` - a human-readable description of the error
|
66
|
-
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
67
|
-
*/
|
68
|
-
toString(): string;
|
69
|
-
};
|
70
|
-
} & typeof _Error;
|
71
19
|
/**
|
72
|
-
* Indicates that an error occurred during the
|
20
|
+
* Indicates that an error occurred during the setIfNotExists request.
|
73
21
|
*
|
74
22
|
* This response object includes the following fields that you can use to determine
|
75
23
|
* how you would like to handle the error:
|
@@ -78,6 +26,9 @@ declare const Error_base: {
|
|
78
26
|
* - `message()` - a human-readable description of the error
|
79
27
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
80
28
|
*/
|
81
|
-
export declare class Error extends
|
29
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
30
|
+
constructor(_innerException: SdkError);
|
31
|
+
readonly type: CacheSetIfAbsentResponse.Error;
|
82
32
|
}
|
33
|
+
export type Response = Stored | NotStored | Error;
|
83
34
|
export {};
|
@@ -1,54 +1,30 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Error = exports.NotStored = exports.Stored =
|
3
|
+
exports.Error = exports.NotStored = exports.Stored = void 0;
|
4
4
|
const response_base_1 = require("./response-base");
|
5
|
-
|
6
|
-
* Parent response type for a cache setIfAbsent request. The
|
7
|
-
* response object is resolved to a type-safe object of one of
|
8
|
-
* the following subtypes:
|
9
|
-
*
|
10
|
-
* - {Stored}
|
11
|
-
* - {NotStored}
|
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 CacheSetIfAbsent.Error) {
|
19
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
-
* // `CacheSetIfAbsent.Error` in this block, so you will have access to the properties
|
21
|
-
* // of the Error class; e.g. `response.errorCode()`.
|
22
|
-
* }
|
23
|
-
* ```
|
24
|
-
*/
|
25
|
-
class Response extends response_base_1.ResponseBase {
|
26
|
-
}
|
27
|
-
exports.Response = Response;
|
28
|
-
class _Stored extends Response {
|
29
|
-
}
|
5
|
+
const enums_1 = require("./enums");
|
30
6
|
/**
|
31
7
|
* Indicates the key did not exist and the value was set.
|
32
8
|
*/
|
33
|
-
class Stored extends
|
9
|
+
class Stored extends response_base_1.ResponseBase {
|
10
|
+
constructor() {
|
11
|
+
super(...arguments);
|
12
|
+
this.type = enums_1.CacheSetIfAbsentResponse.Stored;
|
13
|
+
}
|
34
14
|
}
|
35
15
|
exports.Stored = Stored;
|
36
|
-
class _NotStored extends Response {
|
37
|
-
}
|
38
16
|
/**
|
39
|
-
* Indicates the key
|
17
|
+
* Indicates the key already exists and no value was set.
|
40
18
|
*/
|
41
|
-
class NotStored extends
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
constructor(_innerException) {
|
46
|
-
super();
|
47
|
-
this._innerException = _innerException;
|
19
|
+
class NotStored extends response_base_1.ResponseBase {
|
20
|
+
constructor() {
|
21
|
+
super(...arguments);
|
22
|
+
this.type = enums_1.CacheSetIfAbsentResponse.NotStored;
|
48
23
|
}
|
49
24
|
}
|
25
|
+
exports.NotStored = NotStored;
|
50
26
|
/**
|
51
|
-
* Indicates that an error occurred during the
|
27
|
+
* Indicates that an error occurred during the setIfNotExists request.
|
52
28
|
*
|
53
29
|
* This response object includes the following fields that you can use to determine
|
54
30
|
* how you would like to handle the error:
|
@@ -57,7 +33,11 @@ class _Error extends Response {
|
|
57
33
|
* - `message()` - a human-readable description of the error
|
58
34
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
59
35
|
*/
|
60
|
-
class Error extends
|
36
|
+
class Error extends response_base_1.BaseResponseError {
|
37
|
+
constructor(_innerException) {
|
38
|
+
super(_innerException);
|
39
|
+
this.type = enums_1.CacheSetIfAbsentResponse.Error;
|
40
|
+
}
|
61
41
|
}
|
62
42
|
exports.Error = Error;
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
43
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JlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIEJhc2VSZXNwb25zZUVycm9yIGltcGxlbWVudHMgSVJlc3BvbnNlIHtcbiAgY29uc3RydWN0b3IoX2lubmVyRXhjZXB0aW9uOiBTZGtFcnJvcikge1xuICAgIHN1cGVyKF9pbm5lckV4Y2VwdGlvbik7XG4gIH1cblxuICByZWFkb25seSB0eXBlOiBDYWNoZVNldElmQWJzZW50UmVzcG9uc2UuRXJyb3IgPVxuICAgIENhY2hlU2V0SWZBYnNlbnRSZXNwb25zZS5FcnJvcjtcbn1cblxuZXhwb3J0IHR5cGUgUmVzcG9uc2UgPSBTdG9yZWQgfCBOb3RTdG9yZWQgfCBFcnJvcjtcbiJdfQ==
|
@@ -1,66 +1,23 @@
|
|
1
1
|
import { SdkError } from '../../errors';
|
2
|
-
import { ResponseBase } from './response-base';
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* the following subtypes:
|
7
|
-
*
|
8
|
-
* - {Stored}
|
9
|
-
* - {NotStored}
|
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 CacheSetIfEqual.Error) {
|
17
|
-
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
-
* // `CacheSetIfEqual.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 {
|
24
|
-
}
|
25
|
-
declare class _Stored extends Response {
|
2
|
+
import { BaseResponseError, ResponseBase } from './response-base';
|
3
|
+
import { CacheSetIfEqualResponse } from './enums';
|
4
|
+
interface IResponse {
|
5
|
+
readonly type: CacheSetIfEqualResponse;
|
26
6
|
}
|
27
|
-
declare const Stored_base: {
|
28
|
-
new (...args: any[]): {
|
29
|
-
readonly is_success: boolean;
|
30
|
-
};
|
31
|
-
} & typeof _Stored;
|
32
7
|
/**
|
33
|
-
* Indicates the key
|
8
|
+
* Indicates the new value was set because the key already exists and the existing item was equal to the supplied `equal` value.
|
34
9
|
*/
|
35
|
-
export declare class Stored extends
|
10
|
+
export declare class Stored extends ResponseBase implements IResponse {
|
11
|
+
readonly type: CacheSetIfEqualResponse.Stored;
|
36
12
|
}
|
37
|
-
declare class _NotStored extends Response {
|
38
|
-
}
|
39
|
-
declare const NotStored_base: {
|
40
|
-
new (...args: any[]): {
|
41
|
-
readonly is_success: boolean;
|
42
|
-
};
|
43
|
-
} & typeof _NotStored;
|
44
13
|
/**
|
45
|
-
* Indicates the key
|
14
|
+
* Indicates that no value was set because the key did not exist or because the existing item was not equal to the supplied `equal` value.
|
46
15
|
*/
|
47
|
-
export declare class NotStored extends
|
48
|
-
|
49
|
-
declare class _Error extends Response {
|
50
|
-
protected _innerException: SdkError;
|
51
|
-
constructor(_innerException: SdkError);
|
16
|
+
export declare class NotStored extends ResponseBase implements IResponse {
|
17
|
+
readonly type: CacheSetIfEqualResponse.NotStored;
|
52
18
|
}
|
53
|
-
declare const Error_base: {
|
54
|
-
new (...args: any[]): {
|
55
|
-
_innerException: SdkError;
|
56
|
-
message(): string;
|
57
|
-
innerException(): SdkError;
|
58
|
-
errorCode(): import("../../errors").MomentoErrorCode;
|
59
|
-
toString(): string;
|
60
|
-
};
|
61
|
-
} & typeof _Error;
|
62
19
|
/**
|
63
|
-
* Indicates that an error occurred during the
|
20
|
+
* Indicates that an error occurred during the setIfEqual request.
|
64
21
|
*
|
65
22
|
* This response object includes the following fields that you can use to determine
|
66
23
|
* how you would like to handle the error:
|
@@ -69,6 +26,9 @@ declare const Error_base: {
|
|
69
26
|
* - `message()` - a human-readable description of the error
|
70
27
|
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
71
28
|
*/
|
72
|
-
export declare class Error extends
|
29
|
+
export declare class Error extends BaseResponseError implements IResponse {
|
30
|
+
constructor(_innerException: SdkError);
|
31
|
+
readonly type: CacheSetIfEqualResponse.Error;
|
73
32
|
}
|
33
|
+
export type Response = Stored | NotStored | Error;
|
74
34
|
export {};
|