@gomomento/sdk-core 1.12.8

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.
Files changed (184) hide show
  1. package/dist/src/auth/credential-provider.d.ts +83 -0
  2. package/dist/src/auth/credential-provider.js +82 -0
  3. package/dist/src/auth/index.d.ts +1 -0
  4. package/dist/src/auth/index.js +18 -0
  5. package/dist/src/config/logging/default-momento-logger.d.ts +24 -0
  6. package/dist/src/config/logging/default-momento-logger.js +69 -0
  7. package/dist/src/config/logging/index.d.ts +3 -0
  8. package/dist/src/config/logging/index.js +20 -0
  9. package/dist/src/config/logging/momento-logger.d.ts +10 -0
  10. package/dist/src/config/logging/momento-logger.js +3 -0
  11. package/dist/src/config/logging/noop-momento-logger.d.ts +11 -0
  12. package/dist/src/config/logging/noop-momento-logger.js +34 -0
  13. package/dist/src/config/transport/grpc-configuration.d.ts +41 -0
  14. package/dist/src/config/transport/grpc-configuration.js +3 -0
  15. package/dist/src/config/transport/index.d.ts +2 -0
  16. package/dist/src/config/transport/index.js +19 -0
  17. package/dist/src/config/transport/transport-strategy.d.ts +77 -0
  18. package/dist/src/config/transport/transport-strategy.js +60 -0
  19. package/dist/src/errors/error-utils.d.ts +2 -0
  20. package/dist/src/errors/error-utils.js +12 -0
  21. package/dist/src/errors/errors.d.ts +140 -0
  22. package/dist/src/errors/errors.js +229 -0
  23. package/dist/src/errors/index.d.ts +2 -0
  24. package/dist/src/errors/index.js +19 -0
  25. package/dist/src/index.d.ts +57 -0
  26. package/dist/src/index.js +137 -0
  27. package/dist/src/internal/clients/auth/AbstractAuthClient.d.ts +10 -0
  28. package/dist/src/internal/clients/auth/AbstractAuthClient.js +13 -0
  29. package/dist/src/internal/clients/auth/IAuthClient.d.ts +4 -0
  30. package/dist/src/internal/clients/auth/IAuthClient.js +3 -0
  31. package/dist/src/internal/clients/auth/index.d.ts +2 -0
  32. package/dist/src/internal/clients/auth/index.js +19 -0
  33. package/dist/src/internal/clients/cache/AbstractCacheClient.d.ts +638 -0
  34. package/dist/src/internal/clients/cache/AbstractCacheClient.js +870 -0
  35. package/dist/src/internal/clients/cache/ICacheClient.d.ts +45 -0
  36. package/dist/src/internal/clients/cache/ICacheClient.js +3 -0
  37. package/dist/src/internal/clients/cache/IControlClient.d.ts +7 -0
  38. package/dist/src/internal/clients/cache/IControlClient.js +3 -0
  39. package/dist/src/internal/clients/cache/IDataClient.d.ts +29 -0
  40. package/dist/src/internal/clients/cache/IDataClient.js +3 -0
  41. package/dist/src/internal/clients/cache/index.d.ts +4 -0
  42. package/dist/src/internal/clients/cache/index.js +21 -0
  43. package/dist/src/internal/clients/index.d.ts +3 -0
  44. package/dist/src/internal/clients/index.js +20 -0
  45. package/dist/src/internal/clients/ping/AbstractPingClient.d.ts +25 -0
  46. package/dist/src/internal/clients/ping/AbstractPingClient.js +29 -0
  47. package/dist/src/internal/clients/ping/IPingClient.d.ts +3 -0
  48. package/dist/src/internal/clients/ping/IPingClient.js +3 -0
  49. package/dist/src/internal/clients/ping/index.d.ts +2 -0
  50. package/dist/src/internal/clients/ping/index.js +19 -0
  51. package/dist/src/internal/subscription-state.d.ts +15 -0
  52. package/dist/src/internal/subscription-state.js +38 -0
  53. package/dist/src/internal/utils/auth.d.ts +25 -0
  54. package/dist/src/internal/utils/auth.js +50 -0
  55. package/dist/src/internal/utils/collections.d.ts +1 -0
  56. package/dist/src/internal/utils/collections.js +8 -0
  57. package/dist/src/internal/utils/display.d.ts +2 -0
  58. package/dist/src/internal/utils/display.js +30 -0
  59. package/dist/src/internal/utils/index.d.ts +7 -0
  60. package/dist/src/internal/utils/index.js +24 -0
  61. package/dist/src/internal/utils/object.d.ts +1 -0
  62. package/dist/src/internal/utils/object.js +8 -0
  63. package/dist/src/internal/utils/sleep.d.ts +1 -0
  64. package/dist/src/internal/utils/sleep.js +6 -0
  65. package/dist/src/internal/utils/string.d.ts +2 -0
  66. package/dist/src/internal/utils/string.js +17 -0
  67. package/dist/src/internal/utils/validators.d.ts +13 -0
  68. package/dist/src/internal/utils/validators.js +105 -0
  69. package/dist/src/internal/vendor/printf/README.md +31 -0
  70. package/dist/src/internal/vendor/printf/printf.d.ts +9 -0
  71. package/dist/src/internal/vendor/printf/printf.js +478 -0
  72. package/dist/src/messages/cache-info.d.ts +5 -0
  73. package/dist/src/messages/cache-info.js +13 -0
  74. package/dist/src/messages/responses/cache-delete.d.ts +61 -0
  75. package/dist/src/messages/responses/cache-delete.js +54 -0
  76. package/dist/src/messages/responses/cache-dictionary-fetch.d.ts +120 -0
  77. package/dist/src/messages/responses/cache-dictionary-fetch.js +162 -0
  78. package/dist/src/messages/responses/cache-dictionary-get-field.d.ts +123 -0
  79. package/dist/src/messages/responses/cache-dictionary-get-field.js +143 -0
  80. package/dist/src/messages/responses/cache-dictionary-get-fields.d.ts +122 -0
  81. package/dist/src/messages/responses/cache-dictionary-get-fields.js +173 -0
  82. package/dist/src/messages/responses/cache-dictionary-increment.d.ts +69 -0
  83. package/dist/src/messages/responses/cache-dictionary-increment.js +68 -0
  84. package/dist/src/messages/responses/cache-dictionary-remove-field.d.ts +61 -0
  85. package/dist/src/messages/responses/cache-dictionary-remove-field.js +54 -0
  86. package/dist/src/messages/responses/cache-dictionary-remove-fields.d.ts +61 -0
  87. package/dist/src/messages/responses/cache-dictionary-remove-fields.js +54 -0
  88. package/dist/src/messages/responses/cache-dictionary-set-field.d.ts +61 -0
  89. package/dist/src/messages/responses/cache-dictionary-set-field.js +54 -0
  90. package/dist/src/messages/responses/cache-dictionary-set-fields.d.ts +61 -0
  91. package/dist/src/messages/responses/cache-dictionary-set-fields.js +54 -0
  92. package/dist/src/messages/responses/cache-flush.d.ts +61 -0
  93. package/dist/src/messages/responses/cache-flush.js +54 -0
  94. package/dist/src/messages/responses/cache-get.d.ts +86 -0
  95. package/dist/src/messages/responses/cache-get.js +88 -0
  96. package/dist/src/messages/responses/cache-increment.d.ts +69 -0
  97. package/dist/src/messages/responses/cache-increment.js +68 -0
  98. package/dist/src/messages/responses/cache-list-concatenate-back.d.ts +69 -0
  99. package/dist/src/messages/responses/cache-list-concatenate-back.js +68 -0
  100. package/dist/src/messages/responses/cache-list-concatenate-front.d.ts +69 -0
  101. package/dist/src/messages/responses/cache-list-concatenate-front.js +68 -0
  102. package/dist/src/messages/responses/cache-list-fetch.d.ts +92 -0
  103. package/dist/src/messages/responses/cache-list-fetch.js +96 -0
  104. package/dist/src/messages/responses/cache-list-length.d.ts +84 -0
  105. package/dist/src/messages/responses/cache-list-length.js +78 -0
  106. package/dist/src/messages/responses/cache-list-pop-back.d.ts +86 -0
  107. package/dist/src/messages/responses/cache-list-pop-back.js +88 -0
  108. package/dist/src/messages/responses/cache-list-pop-front.d.ts +86 -0
  109. package/dist/src/messages/responses/cache-list-pop-front.js +88 -0
  110. package/dist/src/messages/responses/cache-list-push-back.d.ts +69 -0
  111. package/dist/src/messages/responses/cache-list-push-back.js +68 -0
  112. package/dist/src/messages/responses/cache-list-push-front.d.ts +69 -0
  113. package/dist/src/messages/responses/cache-list-push-front.js +68 -0
  114. package/dist/src/messages/responses/cache-list-remove-value.d.ts +61 -0
  115. package/dist/src/messages/responses/cache-list-remove-value.js +54 -0
  116. package/dist/src/messages/responses/cache-list-retain.d.ts +61 -0
  117. package/dist/src/messages/responses/cache-list-retain.js +54 -0
  118. package/dist/src/messages/responses/cache-set-add-element.d.ts +71 -0
  119. package/dist/src/messages/responses/cache-set-add-element.js +54 -0
  120. package/dist/src/messages/responses/cache-set-add-elements.d.ts +65 -0
  121. package/dist/src/messages/responses/cache-set-add-elements.js +61 -0
  122. package/dist/src/messages/responses/cache-set-fetch.d.ts +111 -0
  123. package/dist/src/messages/responses/cache-set-fetch.js +121 -0
  124. package/dist/src/messages/responses/cache-set-if-not-exists.d.ts +74 -0
  125. package/dist/src/messages/responses/cache-set-if-not-exists.js +63 -0
  126. package/dist/src/messages/responses/cache-set-remove-element.d.ts +61 -0
  127. package/dist/src/messages/responses/cache-set-remove-element.js +54 -0
  128. package/dist/src/messages/responses/cache-set-remove-elements.d.ts +65 -0
  129. package/dist/src/messages/responses/cache-set-remove-elements.js +61 -0
  130. package/dist/src/messages/responses/cache-set.d.ts +61 -0
  131. package/dist/src/messages/responses/cache-set.js +54 -0
  132. package/dist/src/messages/responses/cache-sorted-set-fetch.d.ts +107 -0
  133. package/dist/src/messages/responses/cache-sorted-set-fetch.js +124 -0
  134. package/dist/src/messages/responses/cache-sorted-set-get-rank.d.ts +81 -0
  135. package/dist/src/messages/responses/cache-sorted-set-get-rank.js +78 -0
  136. package/dist/src/messages/responses/cache-sorted-set-get-score.d.ts +118 -0
  137. package/dist/src/messages/responses/cache-sorted-set-get-score.js +131 -0
  138. package/dist/src/messages/responses/cache-sorted-set-get-scores.d.ts +109 -0
  139. package/dist/src/messages/responses/cache-sorted-set-get-scores.js +148 -0
  140. package/dist/src/messages/responses/cache-sorted-set-increment-score.d.ts +69 -0
  141. package/dist/src/messages/responses/cache-sorted-set-increment-score.js +68 -0
  142. package/dist/src/messages/responses/cache-sorted-set-put-element.d.ts +61 -0
  143. package/dist/src/messages/responses/cache-sorted-set-put-element.js +54 -0
  144. package/dist/src/messages/responses/cache-sorted-set-put-elements.d.ts +61 -0
  145. package/dist/src/messages/responses/cache-sorted-set-put-elements.js +54 -0
  146. package/dist/src/messages/responses/cache-sorted-set-remove-element.d.ts +61 -0
  147. package/dist/src/messages/responses/cache-sorted-set-remove-element.js +54 -0
  148. package/dist/src/messages/responses/cache-sorted-set-remove-elements.d.ts +61 -0
  149. package/dist/src/messages/responses/cache-sorted-set-remove-elements.js +54 -0
  150. package/dist/src/messages/responses/create-cache.d.ts +77 -0
  151. package/dist/src/messages/responses/create-cache.js +61 -0
  152. package/dist/src/messages/responses/create-signing-key.d.ts +71 -0
  153. package/dist/src/messages/responses/create-signing-key.js +76 -0
  154. package/dist/src/messages/responses/delete-cache.d.ts +61 -0
  155. package/dist/src/messages/responses/delete-cache.js +54 -0
  156. package/dist/src/messages/responses/generate-api-token.d.ts +50 -0
  157. package/dist/src/messages/responses/generate-api-token.js +52 -0
  158. package/dist/src/messages/responses/grpc-response-types.d.ts +41 -0
  159. package/dist/src/messages/responses/grpc-response-types.js +53 -0
  160. package/dist/src/messages/responses/list-caches.d.ts +70 -0
  161. package/dist/src/messages/responses/list-caches.js +69 -0
  162. package/dist/src/messages/responses/list-signing-keys.d.ts +68 -0
  163. package/dist/src/messages/responses/list-signing-keys.js +68 -0
  164. package/dist/src/messages/responses/response-base.d.ts +43 -0
  165. package/dist/src/messages/responses/response-base.js +50 -0
  166. package/dist/src/messages/responses/revoke-signing-key.d.ts +61 -0
  167. package/dist/src/messages/responses/revoke-signing-key.js +54 -0
  168. package/dist/src/messages/responses/topic-item.d.ts +27 -0
  169. package/dist/src/messages/responses/topic-item.js +43 -0
  170. package/dist/src/messages/responses/topic-publish.d.ts +61 -0
  171. package/dist/src/messages/responses/topic-publish.js +54 -0
  172. package/dist/src/messages/responses/topic-subscribe.d.ts +69 -0
  173. package/dist/src/messages/responses/topic-subscribe.js +72 -0
  174. package/dist/src/messages/signing-key.d.ts +9 -0
  175. package/dist/src/messages/signing-key.js +21 -0
  176. package/dist/src/utils/cache-call-options.d.ts +99 -0
  177. package/dist/src/utils/cache-call-options.js +9 -0
  178. package/dist/src/utils/collection-ttl.d.ts +78 -0
  179. package/dist/src/utils/collection-ttl.js +102 -0
  180. package/dist/src/utils/index.d.ts +3 -0
  181. package/dist/src/utils/index.js +20 -0
  182. package/dist/src/utils/topic-call-options.d.ts +19 -0
  183. package/dist/src/utils/topic-call-options.js +3 -0
  184. package/package.json +53 -0
@@ -0,0 +1,92 @@
1
+ import { SdkError } from '../../errors/errors';
2
+ import { ResponseBase } from './response-base';
3
+ /**
4
+ * Parent response type for a list fetch request. The
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 CacheListFetch.Error) {
17
+ * // Handle error as appropriate. The compiler will smart-cast `response` to type
18
+ * // `CacheListFetch.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 _Hit extends Response {
26
+ private readonly _values;
27
+ constructor(values: Uint8Array[]);
28
+ /**
29
+ * Returns the data as an array of byte arrays.
30
+ * @returns {Uint8Array[]}
31
+ */
32
+ valueListUint8Array(): Uint8Array[];
33
+ /**
34
+ * Returns the data as an array of strings, decoded from the underlying byte array.
35
+ * @returns {string[]}
36
+ */
37
+ valueListString(): string[];
38
+ /**
39
+ * Returns the data as an array of strings, decoded from the underlying byte array. This is a convenience alias
40
+ * for {valueListString}
41
+ * @returns {string[]}
42
+ */
43
+ valueList(): string[];
44
+ toString(): string;
45
+ }
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
+ /**
63
+ * Indicates that the requested data was not available in the cache.
64
+ */
65
+ export declare class Miss extends Miss_base {
66
+ }
67
+ declare class _Error extends Response {
68
+ protected _innerException: SdkError;
69
+ constructor(_innerException: SdkError);
70
+ }
71
+ declare const Error_base: {
72
+ new (...args: any[]): {
73
+ _innerException: SdkError;
74
+ message(): string;
75
+ innerException(): SdkError;
76
+ errorCode(): import("../../errors/errors").MomentoErrorCode;
77
+ toString(): string;
78
+ };
79
+ } & typeof _Error;
80
+ /**
81
+ * Indicates that an error occurred during the cache delete request.
82
+ *
83
+ * This response object includes the following fields that you can use to determine
84
+ * how you would like to handle the error:
85
+ *
86
+ * - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
87
+ * - `message()` - a human-readable description of the error
88
+ * - `innerException()` - the original error that caused the failure; can be re-thrown.
89
+ */
90
+ export declare class Error extends Error_base {
91
+ }
92
+ export {};
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Error = exports.Miss = exports.Hit = exports.Response = void 0;
4
+ const response_base_1 = require("./response-base");
5
+ const display_1 = require("../../internal/utils/display");
6
+ const TEXT_DECODER = new TextDecoder();
7
+ /**
8
+ * Parent response type for a list fetch request. The
9
+ * response object is resolved to a type-safe object of one of
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 CacheListFetch.Error) {
21
+ * // Handle error as appropriate. The compiler will smart-cast `response` to type
22
+ * // `CacheListFetch.Error` in this block, so you will have access to the properties
23
+ * // of the Error class; e.g. `response.errorCode()`.
24
+ * }
25
+ * ```
26
+ */
27
+ class Response extends response_base_1.ResponseBase {
28
+ }
29
+ exports.Response = Response;
30
+ class _Hit extends Response {
31
+ constructor(values) {
32
+ super();
33
+ this._values = values;
34
+ }
35
+ /**
36
+ * Returns the data as an array of byte arrays.
37
+ * @returns {Uint8Array[]}
38
+ */
39
+ valueListUint8Array() {
40
+ return this._values;
41
+ }
42
+ /**
43
+ * Returns the data as an array of strings, decoded from the underlying byte array.
44
+ * @returns {string[]}
45
+ */
46
+ valueListString() {
47
+ return this._values.map(v => TEXT_DECODER.decode(v));
48
+ }
49
+ /**
50
+ * Returns the data as an array of strings, decoded from the underlying byte array. This is a convenience alias
51
+ * for {valueListString}
52
+ * @returns {string[]}
53
+ */
54
+ valueList() {
55
+ return this.valueListString();
56
+ }
57
+ toString() {
58
+ const truncatedStringArray = (0, display_1.truncateStringArray)(this.valueListString());
59
+ return `${super.toString()}: [${truncatedStringArray.toString()}]`;
60
+ }
61
+ }
62
+ /**
63
+ * Indicates that the requested data was successfully retrieved from the cache. Provides
64
+ * `value*` accessors to retrieve the data in the appropriate format.
65
+ */
66
+ class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
67
+ }
68
+ exports.Hit = Hit;
69
+ class _Miss extends Response {
70
+ }
71
+ /**
72
+ * Indicates that the requested data was not available in the cache.
73
+ */
74
+ class Miss extends (0, response_base_1.ResponseMiss)(_Miss) {
75
+ }
76
+ exports.Miss = Miss;
77
+ class _Error extends Response {
78
+ constructor(_innerException) {
79
+ super();
80
+ this._innerException = _innerException;
81
+ }
82
+ }
83
+ /**
84
+ * Indicates that an error occurred during the cache delete request.
85
+ *
86
+ * This response object includes the following fields that you can use to determine
87
+ * how you would like to handle the error:
88
+ *
89
+ * - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
90
+ * - `message()` - a human-readable description of the error
91
+ * - `innerException()` - the original error that caused the failure; can be re-thrown.
92
+ */
93
+ class Error extends (0, response_base_1.ResponseError)(_Error) {
94
+ }
95
+ exports.Error = Error;
96
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtbGlzdC1mZXRjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvY2FjaGUtbGlzdC1mZXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtREFLeUI7QUFDekIsMERBQWlFO0FBRWpFLE1BQU0sWUFBWSxHQUFHLElBQUksV0FBVyxFQUFFLENBQUM7QUFFdkM7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FtQkc7QUFDSCxNQUFzQixRQUFTLFNBQVEsNEJBQVk7Q0FBRztBQUF0RCw0QkFBc0Q7QUFFdEQsT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XVlc3RlZCBkYXRhIHdhcyBub3QgYXZhaWxhYmxlIGluIHRoZSBjYWNoZS5cbiAqL1xuZXhwb3J0IGNsYXNzIE1pc3MgZXh0ZW5kcyBSZXNwb25zZU1pc3MoX01pc3MpIHt9XG5cbmNsYXNzIF9FcnJvciBleHRlbmRzIFJlc3BvbnNlIHtcbiAgY29uc3RydWN0b3IocHJvdGVjdGVkIF9pbm5lckV4Y2VwdGlvbjogU2RrRXJyb3IpIHtcbiAgICBzdXBlcigpO1xuICB9XG59XG5cbi8qKlxuICogSW5kaWNhdGVzIHRoYXQgYW4gZXJyb3Igb2NjdXJyZWQgZHVyaW5nIHRoZSBjYWNoZSBkZWxldGUgcmVxdWVzdC5cbiAqXG4gKiBUaGlzIHJlc3BvbnNlIG9iamVjdCBpbmNsdWRlcyB0aGUgZm9sbG93aW5nIGZpZWxkcyB0aGF0IHlvdSBjYW4gdXNlIHRvIGRldGVybWluZVxuICogaG93IHlvdSB3b3VsZCBsaWtlIHRvIGhhbmRsZSB0aGUgZXJyb3I6XG4gKlxuICogLSBgZXJyb3JDb2RlKClgIC0gYSB1bmlxdWUgTW9tZW50byBlcnJvciBjb2RlIGluZGljYXRpbmcgdGhlIHR5cGUgb2YgZXJyb3IgdGhhdCBvY2N1cnJlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIFJlc3BvbnNlRXJyb3IoX0Vycm9yKSB7fVxuIl19
@@ -0,0 +1,84 @@
1
+ import { SdkError } from '../../errors/errors';
2
+ import { ResponseBase } from './response-base';
3
+ /**
4
+ * Parent response type for a list length request. The
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 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
+ * ```
22
+ */
23
+ export declare abstract class Response extends ResponseBase {
24
+ }
25
+ declare class _Hit extends Response {
26
+ private readonly _length;
27
+ constructor(length: number);
28
+ /**
29
+ * Returns the length of the list
30
+ * @returns {number}
31
+ */
32
+ length(): number;
33
+ toString(): string;
34
+ }
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
+ * `value*` accessors to retrieve the data in the appropriate format.
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
+ /**
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/errors").MomentoErrorCode;
69
+ toString(): string;
70
+ };
71
+ } & typeof _Error;
72
+ /**
73
+ * Indicates that an error occurred during the list length request.
74
+ *
75
+ * This response object includes the following fields that you can use to determine
76
+ * how you would like to handle the error:
77
+ *
78
+ * - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
79
+ * - `message()` - a human-readable description of the error
80
+ * - `innerException()` - the original error that caused the failure; can be re-thrown.
81
+ */
82
+ export declare class Error extends Error_base {
83
+ }
84
+ export {};
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Error = exports.Miss = exports.Hit = exports.Response = void 0;
4
+ const response_base_1 = require("./response-base");
5
+ /**
6
+ * Parent response type for a list length request. The
7
+ * response object is resolved to a type-safe object of one of
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
+ * ```
24
+ */
25
+ class Response extends response_base_1.ResponseBase {
26
+ }
27
+ exports.Response = Response;
28
+ class _Hit extends Response {
29
+ constructor(length) {
30
+ super();
31
+ this._length = length;
32
+ }
33
+ /**
34
+ * Returns the length of the list
35
+ * @returns {number}
36
+ */
37
+ length() {
38
+ return this._length;
39
+ }
40
+ toString() {
41
+ return `${super.toString()}: length ${this._length}`;
42
+ }
43
+ }
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
+ exports.Hit = Hit;
51
+ class _Miss extends Response {
52
+ }
53
+ /**
54
+ * Indicates that the requested data was not available in the cache.
55
+ */
56
+ class Miss extends (0, response_base_1.ResponseMiss)(_Miss) {
57
+ }
58
+ exports.Miss = Miss;
59
+ class _Error extends Response {
60
+ constructor(_innerException) {
61
+ super();
62
+ this._innerException = _innerException;
63
+ }
64
+ }
65
+ /**
66
+ * Indicates that an error occurred during the list length request.
67
+ *
68
+ * This response object includes the following fields that you can use to determine
69
+ * how you would like to handle the error:
70
+ *
71
+ * - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
72
+ * - `message()` - a human-readable description of the error
73
+ * - `innerException()` - the original error that caused the failure; can be re-thrown.
74
+ */
75
+ class Error extends (0, response_base_1.ResponseError)(_Error) {
76
+ }
77
+ exports.Error = Error;
78
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtbGlzdC1sZW5ndGguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbWVzc2FnZXMvcmVzcG9uc2VzL2NhY2hlLWxpc3QtbGVuZ3RoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG1EQUt5QjtBQUV6Qjs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CRztBQUNILE1BQXNCLFFBQVMsU0FBUSw0QkFBWTtDQUFHO0FBQXRELDRCQUFzRDtBQUV0RCxNQUFNLElBQUssU0FBUSxRQUFRO0lBRXpCLFlBQVksTUFBYztRQUN4QixLQUFLLEVBQUUsQ0FBQztRQUNSLElBQUksQ0FBQyxPQUFPLEdBQUcsTUFBTSxDQUFDO0lBQ3hCLENBQUM7SUFFRDs7O09BR0c7SUFDSSxNQUFNO1FBQ1gsT0FBTyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3RCLENBQUM7SUFFZSxRQUFRO1FBQ3RCLE9BQU8sR0FBRyxLQUFLLENBQUMsUUFBUSxFQUFFLFlBQVksSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ3ZELENBQUM7Q0FDRjtBQUVEOzs7R0FHRztBQUNILE1BQWEsR0FBSSxTQUFRLElBQUEsMkJBQVcsRUFBQyxJQUFJLENBQUM7Q0FBRztBQUE3QyxrQkFBNkM7QUFFN0MsTUFBTSxLQUFN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vbiBvZiB0aGUgZXJyb3JcbiAqIC0gYGlubmVyRXhjZXB0aW9uKClgIC0gdGhlIG9yaWdpbmFsIGVycm9yIHRoYXQgY2F1c2VkIHRoZSBmYWlsdXJlOyBjYW4gYmUgcmUtdGhyb3duLlxuICovXG5leHBvcnQgY2xhc3MgRXJyb3IgZXh0ZW5kcyBSZXNwb25zZUVycm9yKF9FcnJvcikge31cbiJdfQ==
@@ -0,0 +1,86 @@
1
+ import { SdkError } from '../../errors/errors';
2
+ import { ResponseBase } from './response-base';
3
+ /**
4
+ * Parent response type for a list pop back request. The
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 {
24
+ }
25
+ declare class _Hit extends Response {
26
+ private readonly body;
27
+ constructor(body: Uint8Array);
28
+ /**
29
+ * Returns the data as a utf-8 string, decoded from the underlying byte array.
30
+ * @returns string
31
+ */
32
+ valueString(): string;
33
+ /**
34
+ * Returns the data as a byte array.
35
+ * @returns {Uint8Array}
36
+ */
37
+ valueUint8Array(): Uint8Array;
38
+ toString(): string;
39
+ }
40
+ declare const Hit_base: {
41
+ new (...args: any[]): {};
42
+ } & typeof _Hit;
43
+ /**
44
+ * Indicates that the requested data was successfully retrieved from the cache. Provides
45
+ * `value*` accessors to retrieve the data in the appropriate format.
46
+ */
47
+ export declare class Hit extends Hit_base {
48
+ }
49
+ declare class _Miss extends Response {
50
+ }
51
+ declare const Miss_base: {
52
+ new (...args: any[]): {
53
+ readonly is_miss: boolean;
54
+ };
55
+ } & typeof _Miss;
56
+ /**
57
+ * Indicates that the requested data was not available in the cache.
58
+ */
59
+ export declare class Miss extends Miss_base {
60
+ }
61
+ declare class _Error extends Response {
62
+ protected _innerException: SdkError;
63
+ constructor(_innerException: SdkError);
64
+ }
65
+ declare const Error_base: {
66
+ new (...args: any[]): {
67
+ _innerException: SdkError;
68
+ message(): string;
69
+ innerException(): SdkError;
70
+ errorCode(): import("../../errors/errors").MomentoErrorCode;
71
+ toString(): string;
72
+ };
73
+ } & typeof _Error;
74
+ /**
75
+ * Indicates that an error occurred during the list pop back 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.
83
+ */
84
+ export declare class Error extends Error_base {
85
+ }
86
+ export {};
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Error = exports.Miss = exports.Hit = exports.Response = void 0;
4
+ const response_base_1 = require("./response-base");
5
+ const display_1 = require("../../internal/utils/display");
6
+ const TEXT_DECODER = new TextDecoder();
7
+ /**
8
+ * Parent response type for a list pop back request. The
9
+ * response object is resolved to a type-safe object of one of
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
+ * ```
26
+ */
27
+ class Response extends response_base_1.ResponseBase {
28
+ }
29
+ exports.Response = Response;
30
+ class _Hit extends Response {
31
+ constructor(body) {
32
+ super();
33
+ this.body = body;
34
+ }
35
+ /**
36
+ * Returns the data as a utf-8 string, decoded from the underlying byte array.
37
+ * @returns string
38
+ */
39
+ valueString() {
40
+ return TEXT_DECODER.decode(this.body);
41
+ }
42
+ /**
43
+ * Returns the data as a byte array.
44
+ * @returns {Uint8Array}
45
+ */
46
+ valueUint8Array() {
47
+ return this.body;
48
+ }
49
+ toString() {
50
+ const display = (0, display_1.truncateString)(this.valueString());
51
+ return `${super.toString()}: ${display}`;
52
+ }
53
+ }
54
+ /**
55
+ * Indicates that the requested data was successfully retrieved from the cache. Provides
56
+ * `value*` accessors to retrieve the data in the appropriate format.
57
+ */
58
+ class Hit extends (0, response_base_1.ResponseHit)(_Hit) {
59
+ }
60
+ exports.Hit = Hit;
61
+ class _Miss extends Response {
62
+ }
63
+ /**
64
+ * Indicates that the requested data was not available in the cache.
65
+ */
66
+ class Miss extends (0, response_base_1.ResponseMiss)(_Miss) {
67
+ }
68
+ exports.Miss = Miss;
69
+ class _Error extends Response {
70
+ constructor(_innerException) {
71
+ super();
72
+ this._innerException = _innerException;
73
+ }
74
+ }
75
+ /**
76
+ * Indicates that an error occurred during the list pop back request.
77
+ *
78
+ * This response object includes the following fields that you can use to determine
79
+ * how you would like to handle the error:
80
+ *
81
+ * - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
82
+ * - `message()` - a human-readable description of the error
83
+ * - `innerException()` - the original error that caused the failure; can be re-thrown.
84
+ */
85
+ class Error extends (0, response_base_1.ResponseError)(_Error) {
86
+ }
87
+ exports.Error = Error;
88
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FjaGUtbGlzdC1wb3AtYmFjay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvY2FjaGUtbGlzdC1wb3AtYmFjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtREFLeUI7QUF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biB1c2UgdG8gZGV0ZXJtaW5lXG4gKiBob3cgeW91IHdvdWxkIGxpa2UgdG8gaGFuZGxlIHRoZSBlcnJvcjpcbiAqXG4gKiAtIGBlcnJvckNvZGUoKWAgLSBhIHVuaXF1ZSBNb21lbnRvIGVycm9yIGNvZGUgaW5kaWNhdGluZyB0aGUgdHlwZSBvZiBlcnJvciB0aGF0IG9jY3VycmVkLlxuICogLSBgbWVzc2FnZSgpYCAtIGEgaHVtYW4tcmVhZGFibGUgZGVzY3JpcHRpb24gb2YgdGhlIGVycm9yXG4gKiAtIGBpbm5lckV4Y2VwdGlvbigpYCAtIHRoZSBvcmlnaW5hbCBlcnJvciB0aGF0IGNhdXNlZCB0aGUgZmFpbHVyZTsgY2FuIGJlIHJlLXRocm93bi5cbiAqL1xuZXhwb3J0IGNsYXNzIEVycm9yIGV4dGVuZHMgUmVzcG9uc2VFcnJvcihfRXJyb3IpIHt9XG4iXX0=
@@ -0,0 +1,86 @@
1
+ import { SdkError } from '../../errors/errors';
2
+ import { ResponseBase } from './response-base';
3
+ /**
4
+ * Parent response type for a list pop front request. The
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 {
24
+ }
25
+ declare class _Hit extends Response {
26
+ private readonly body;
27
+ constructor(body: Uint8Array);
28
+ /**
29
+ * Returns the data as a utf-8 string, decoded from the underlying byte array.
30
+ * @returns string
31
+ */
32
+ valueString(): string;
33
+ /**
34
+ * Returns the data as a byte array.
35
+ * @returns {Uint8Array}
36
+ */
37
+ valueUint8Array(): Uint8Array;
38
+ toString(): string;
39
+ }
40
+ declare const Hit_base: {
41
+ new (...args: any[]): {};
42
+ } & typeof _Hit;
43
+ /**
44
+ * Indicates that the requested data was successfully retrieved from the cache. Provides
45
+ * `value*` accessors to retrieve the data in the appropriate format.
46
+ */
47
+ export declare class Hit extends Hit_base {
48
+ }
49
+ declare class _Miss extends Response {
50
+ }
51
+ declare const Miss_base: {
52
+ new (...args: any[]): {
53
+ readonly is_miss: boolean;
54
+ };
55
+ } & typeof _Miss;
56
+ /**
57
+ * Indicates that the requested data was not available in the cache.
58
+ */
59
+ export declare class Miss extends Miss_base {
60
+ }
61
+ declare class _Error extends Response {
62
+ protected _innerException: SdkError;
63
+ constructor(_innerException: SdkError);
64
+ }
65
+ declare const Error_base: {
66
+ new (...args: any[]): {
67
+ _innerException: SdkError;
68
+ message(): string;
69
+ innerException(): SdkError;
70
+ errorCode(): import("../../errors/errors").MomentoErrorCode;
71
+ toString(): string;
72
+ };
73
+ } & typeof _Error;
74
+ /**
75
+ * Indicates that an error occurred during the list pop front 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.
83
+ */
84
+ export declare class Error extends Error_base {
85
+ }
86
+ export {};