@gomomento/sdk-core 1.35.0 → 1.37.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 +36 -0
- package/dist/src/auth/credential-provider.js +31 -7
- package/dist/src/auth/tokens/disposable-token-scopes.d.ts +8 -0
- package/dist/src/auth/tokens/disposable-token-scopes.js +74 -0
- package/dist/src/auth/tokens/token-scope.d.ts +30 -9
- package/dist/src/auth/tokens/token-scope.js +61 -6
- package/dist/src/clients/IAuthClient.d.ts +3 -2
- package/dist/src/clients/IAuthClient.js +1 -1
- package/dist/src/clients/IVectorIndexClient.d.ts +12 -0
- package/dist/src/clients/IVectorIndexClient.js +3 -0
- package/dist/src/index.d.ts +8 -3
- package/dist/src/index.js +30 -7
- package/dist/src/internal/clients/auth/AbstractAuthClient.d.ts +12 -2
- package/dist/src/internal/clients/auth/AbstractAuthClient.js +13 -1
- package/dist/src/internal/clients/index.d.ts +1 -0
- package/dist/src/internal/clients/index.js +2 -1
- package/dist/src/internal/clients/vector/AbstractVectorIndexClient.d.ts +78 -0
- package/dist/src/internal/clients/vector/AbstractVectorIndexClient.js +91 -0
- package/dist/src/internal/clients/vector/IVectorIndexControlClient.d.ts +6 -0
- package/dist/src/internal/clients/vector/IVectorIndexControlClient.js +3 -0
- package/dist/src/internal/clients/vector/IVectorIndexDataClient.d.ts +8 -0
- package/dist/src/internal/clients/vector/IVectorIndexDataClient.js +3 -0
- package/dist/src/internal/clients/vector/index.d.ts +3 -0
- package/dist/src/internal/clients/vector/index.js +20 -0
- package/dist/src/internal/utils/auth.d.ts +2 -0
- package/dist/src/internal/utils/auth.js +7 -2
- package/dist/src/internal/utils/validators.d.ts +6 -0
- package/dist/src/internal/utils/validators.js +39 -2
- package/dist/src/messages/responses/generate-disposable-token.d.ts +47 -0
- package/dist/src/messages/responses/generate-disposable-token.js +42 -0
- package/dist/src/messages/responses/vector/create-vector-index.d.ts +67 -0
- package/dist/src/messages/responses/vector/create-vector-index.js +61 -0
- package/dist/src/messages/responses/vector/delete-vector-index.d.ts +61 -0
- package/dist/src/messages/responses/vector/delete-vector-index.js +54 -0
- package/dist/src/messages/responses/vector/index.d.ts +6 -0
- package/dist/src/messages/responses/vector/index.js +10 -0
- package/dist/src/messages/responses/vector/list-vector-indexes.d.ts +69 -0
- package/dist/src/messages/responses/vector/list-vector-indexes.js +68 -0
- package/dist/src/messages/responses/vector/vector-add-item-batch.d.ts +61 -0
- package/dist/src/messages/responses/vector/vector-add-item-batch.js +54 -0
- package/dist/src/messages/responses/vector/vector-delete-item-batch.d.ts +62 -0
- package/dist/src/messages/responses/vector/vector-delete-item-batch.js +55 -0
- package/dist/src/messages/responses/vector/vector-search.d.ts +70 -0
- package/dist/src/messages/responses/vector/vector-search.js +67 -0
- package/dist/src/messages/vector-index.d.ts +5 -0
- package/dist/src/messages/vector-index.js +3 -0
- package/package.json +1 -1
@@ -0,0 +1,61 @@
|
|
1
|
+
import { SdkError } from '../../../errors';
|
2
|
+
import { ResponseBase } from '../response-base';
|
3
|
+
/**
|
4
|
+
* Parent response type for a VectorAddItemBatch request. The
|
5
|
+
* response object is resolved to a type-safe object of one of
|
6
|
+
* the following subtypes:
|
7
|
+
*
|
8
|
+
* - {Success}
|
9
|
+
* - {Error}
|
10
|
+
*
|
11
|
+
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
12
|
+
* @example
|
13
|
+
* For example:
|
14
|
+
* ```
|
15
|
+
* if (response instanceof VectorAddItemBatch.Error) {
|
16
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
17
|
+
* // `VectorAddItemBatch.Error` in this block, so you will have access to the properties
|
18
|
+
* // of the Error class; e.g. `response.errorCode()`.
|
19
|
+
* }
|
20
|
+
* ```
|
21
|
+
*/
|
22
|
+
export declare abstract class Response extends ResponseBase {
|
23
|
+
}
|
24
|
+
declare class _Success extends Response {
|
25
|
+
}
|
26
|
+
declare const Success_base: {
|
27
|
+
new (...args: any[]): {
|
28
|
+
readonly is_success: boolean;
|
29
|
+
};
|
30
|
+
} & typeof _Success;
|
31
|
+
/**
|
32
|
+
* Indicates a Successful VectorAddItemBatch request.
|
33
|
+
*/
|
34
|
+
export declare class Success extends Success_base {
|
35
|
+
}
|
36
|
+
declare class _Error extends Response {
|
37
|
+
protected _innerException: SdkError;
|
38
|
+
constructor(_innerException: SdkError);
|
39
|
+
}
|
40
|
+
declare const Error_base: {
|
41
|
+
new (...args: any[]): {
|
42
|
+
_innerException: SdkError;
|
43
|
+
message(): string;
|
44
|
+
innerException(): SdkError;
|
45
|
+
errorCode(): import("../../../errors").MomentoErrorCode;
|
46
|
+
toString(): string;
|
47
|
+
};
|
48
|
+
} & typeof _Error;
|
49
|
+
/**
|
50
|
+
* Indicates that an error occurred during the VectorAddItemBatch request.
|
51
|
+
*
|
52
|
+
* This response object includes the following fields that you can use to determine
|
53
|
+
* how you would like to handle the error:
|
54
|
+
*
|
55
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
56
|
+
* - `message()` - a human-readable description of the error
|
57
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
58
|
+
*/
|
59
|
+
export declare class Error extends Error_base {
|
60
|
+
}
|
61
|
+
export {};
|
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Error = exports.Success = exports.Response = void 0;
|
4
|
+
const response_base_1 = require("../response-base");
|
5
|
+
/**
|
6
|
+
* Parent response type for a VectorAddItemBatch request. The
|
7
|
+
* response object is resolved to a type-safe object of one of
|
8
|
+
* the following subtypes:
|
9
|
+
*
|
10
|
+
* - {Success}
|
11
|
+
* - {Error}
|
12
|
+
*
|
13
|
+
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
14
|
+
* @example
|
15
|
+
* For example:
|
16
|
+
* ```
|
17
|
+
* if (response instanceof VectorAddItemBatch.Error) {
|
18
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
19
|
+
* // `VectorAddItemBatch.Error` in this block, so you will have access to the properties
|
20
|
+
* // of the Error class; e.g. `response.errorCode()`.
|
21
|
+
* }
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
class Response extends response_base_1.ResponseBase {
|
25
|
+
}
|
26
|
+
exports.Response = Response;
|
27
|
+
class _Success extends Response {
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Indicates a Successful VectorAddItemBatch request.
|
31
|
+
*/
|
32
|
+
class Success extends (0, response_base_1.ResponseSuccess)(_Success) {
|
33
|
+
}
|
34
|
+
exports.Success = Success;
|
35
|
+
class _Error extends Response {
|
36
|
+
constructor(_innerException) {
|
37
|
+
super();
|
38
|
+
this._innerException = _innerException;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Indicates that an error occurred during the VectorAddItemBatch request.
|
43
|
+
*
|
44
|
+
* This response object includes the following fields that you can use to determine
|
45
|
+
* how you would like to handle the error:
|
46
|
+
*
|
47
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
48
|
+
* - `message()` - a human-readable description of the error
|
49
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
50
|
+
*/
|
51
|
+
class Error extends (0, response_base_1.ResponseError)(_Error) {
|
52
|
+
}
|
53
|
+
exports.Error = Error;
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLWFkZC1pdGVtLWJhdGNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL21lc3NhZ2VzL3Jlc3BvbnNlcy92ZWN0b3IvdmVjdG9yLWFkZC1pdGVtLWJhdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG9EQUE4RTtBQUU5RTs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBa0JHO0FBQ0gsTUFBc0Is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ZWxkcyB0aGF0IHlvdSBjYW4gdXNlIHRvIGRldGVybWluZVxuICogaG93IHlvdSB3b3VsZCBsaWtlIHRvIGhhbmRsZSB0aGUgZXJyb3I6XG4gKlxuICogLSBgZXJyb3JDb2RlKClgIC0gYSB1bmlxdWUgTW9tZW50byBlcnJvciBjb2RlIGluZGljYXRpbmcgdGhlIHR5cGUgb2YgZXJyb3IgdGhhdCBvY2N1cnJlZC5cbiAqIC0gYG1lc3NhZ2UoKWAgLSBhIGh1bWFuLXJlYWRhYmxlIGRlc2NyaXB0aW9uIG9mIHRoZSBlcnJvclxuICogLSBgaW5uZXJFeGNlcHRpb24oKWAgLSB0aGUgb3JpZ2luYWwgZXJyb3IgdGhhdCBjYXVzZWQgdGhlIGZhaWx1cmU7IGNhbiBiZSByZS10aHJvd24uXG4gKi9cbmV4cG9ydCBjbGFzcyBFcnJvciBleHRlbmRzIFJlc3BvbnNlRXJyb3IoX0Vycm9yKSB7fVxuIl19
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { SdkError } from '../../../errors';
|
2
|
+
import { ResponseBase } from '../response-base';
|
3
|
+
/**
|
4
|
+
* Parent response type for a VectorDeleteItemBatch request. The
|
5
|
+
* response object is resolved to a type-safe object of one of
|
6
|
+
* the following subtypes:
|
7
|
+
*
|
8
|
+
* - {Success}
|
9
|
+
* - {AlreadyExists}
|
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 VectorDeleteItemBatch.Error) {
|
17
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
18
|
+
* // `CreateIndex.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 _Success extends Response {
|
26
|
+
}
|
27
|
+
declare const Success_base: {
|
28
|
+
new (...args: any[]): {
|
29
|
+
readonly is_success: boolean;
|
30
|
+
};
|
31
|
+
} & typeof _Success;
|
32
|
+
/**
|
33
|
+
* Indicates a Successful VectorDeleteItemBatch request.
|
34
|
+
*/
|
35
|
+
export declare class Success extends Success_base {
|
36
|
+
}
|
37
|
+
declare class _Error extends Response {
|
38
|
+
protected _innerException: SdkError;
|
39
|
+
constructor(_innerException: SdkError);
|
40
|
+
}
|
41
|
+
declare const Error_base: {
|
42
|
+
new (...args: any[]): {
|
43
|
+
_innerException: SdkError;
|
44
|
+
message(): string;
|
45
|
+
innerException(): SdkError;
|
46
|
+
errorCode(): import("../../../errors").MomentoErrorCode;
|
47
|
+
toString(): string;
|
48
|
+
};
|
49
|
+
} & typeof _Error;
|
50
|
+
/**
|
51
|
+
* Indicates that an error occurred during the VectorDeleteItemBatch request.
|
52
|
+
*
|
53
|
+
* This response object includes the following fields that you can use to determine
|
54
|
+
* how you would like to handle the error:
|
55
|
+
*
|
56
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
57
|
+
* - `message()` - a human-readable description of the error
|
58
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
59
|
+
*/
|
60
|
+
export declare class Error extends Error_base {
|
61
|
+
}
|
62
|
+
export {};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Error = exports.Success = exports.Response = void 0;
|
4
|
+
const response_base_1 = require("../response-base");
|
5
|
+
/**
|
6
|
+
* Parent response type for a VectorDeleteItemBatch request. The
|
7
|
+
* response object is resolved to a type-safe object of one of
|
8
|
+
* the following subtypes:
|
9
|
+
*
|
10
|
+
* - {Success}
|
11
|
+
* - {AlreadyExists}
|
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 VectorDeleteItemBatch.Error) {
|
19
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
20
|
+
* // `CreateIndex.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 _Success extends Response {
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Indicates a Successful VectorDeleteItemBatch request.
|
32
|
+
*/
|
33
|
+
class Success extends (0, response_base_1.ResponseSuccess)(_Success) {
|
34
|
+
}
|
35
|
+
exports.Success = Success;
|
36
|
+
class _Error extends Response {
|
37
|
+
constructor(_innerException) {
|
38
|
+
super();
|
39
|
+
this._innerException = _innerException;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Indicates that an error occurred during the VectorDeleteItemBatch request.
|
44
|
+
*
|
45
|
+
* This response object includes the following fields that you can use to determine
|
46
|
+
* how you would like to handle the error:
|
47
|
+
*
|
48
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
49
|
+
* - `message()` - a human-readable description of the error
|
50
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
51
|
+
*/
|
52
|
+
class Error extends (0, response_base_1.ResponseError)(_Error) {
|
53
|
+
}
|
54
|
+
exports.Error = Error;
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLWRlbGV0ZS1pdGVtLWJhdGNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL21lc3NhZ2VzL3Jlc3BvbnNlcy92ZWN0b3IvdmVjdG9yLWRlbGV0ZS1pdGVtLWJhdGNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztB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ZXRlSXRlbUJhdGNoIHJlcXVlc3QuXG4gKlxuICogVGhpcyByZXNwb25zZSBvYmplY3QgaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBmaWVsZHMgdGhhdCB5b3UgY2FuIHVzZSB0byBkZXRlcm1pbmVcbiAqIGhvdyB5b3Ugd291bGQgbGlrZSB0byBoYW5kbGUgdGhlIGVycm9yOlxuICpcbiAqIC0gYGVycm9yQ29kZSgpYCAtIGEgdW5pcXVlIE1vbWVudG8gZXJyb3IgY29kZSBpbmRpY2F0aW5nIHRoZSB0eXBlIG9mIGVycm9yIHRoYXQgb2NjdXJyZWQuXG4gKiAtIGBtZXNzYWdlKClgIC0gYSBodW1hbi1yZWFkYWJsZSBkZXNjcmlwdGlvbiBvZiB0aGUgZXJyb3JcbiAqIC0gYGlubmVyRXhjZXB0aW9uKClgIC0gdGhlIG9yaWdpbmFsIGVycm9yIHRoYXQgY2F1c2VkIHRoZSBmYWlsdXJlOyBjYW4gYmUgcmUtdGhyb3duLlxuICovXG5leHBvcnQgY2xhc3MgRXJyb3IgZXh0ZW5kcyBSZXNwb25zZUVycm9yKF9FcnJvcikge31cbiJdfQ==
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { SdkError } from '../../../errors';
|
2
|
+
import { ResponseBase } from '../response-base';
|
3
|
+
export interface SearchHit {
|
4
|
+
id: string;
|
5
|
+
distance: number;
|
6
|
+
metadata: Record<string, string>;
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* Parent response type for a VectorSearch request. The
|
10
|
+
* response object is resolved to a type-safe object of one of
|
11
|
+
* the following subtypes:
|
12
|
+
*
|
13
|
+
* - {Success}
|
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 VectorSearch.Error) {
|
21
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
22
|
+
* // `VectorSearch.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
|
+
export declare abstract class Response extends ResponseBase {
|
28
|
+
hits(): Array<SearchHit> | undefined;
|
29
|
+
}
|
30
|
+
declare class _Success extends Response {
|
31
|
+
}
|
32
|
+
declare const Success_base: {
|
33
|
+
new (...args: any[]): {
|
34
|
+
readonly is_success: boolean;
|
35
|
+
};
|
36
|
+
} & typeof _Success;
|
37
|
+
/**
|
38
|
+
* Indicates a Successful VectorSearch request.
|
39
|
+
*/
|
40
|
+
export declare class Success extends Success_base {
|
41
|
+
private readonly _hits;
|
42
|
+
constructor(hits: Array<SearchHit>);
|
43
|
+
hits(): Array<SearchHit>;
|
44
|
+
}
|
45
|
+
declare class _Error extends Response {
|
46
|
+
protected _innerException: SdkError;
|
47
|
+
constructor(_innerException: SdkError);
|
48
|
+
}
|
49
|
+
declare const Error_base: {
|
50
|
+
new (...args: any[]): {
|
51
|
+
_innerException: SdkError;
|
52
|
+
message(): string;
|
53
|
+
innerException(): SdkError;
|
54
|
+
errorCode(): import("../../../errors").MomentoErrorCode;
|
55
|
+
toString(): string;
|
56
|
+
};
|
57
|
+
} & typeof _Error;
|
58
|
+
/**
|
59
|
+
* Indicates that an error occurred during the VectorSearch 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
|
+
export declare class Error extends Error_base {
|
69
|
+
}
|
70
|
+
export {};
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Error = exports.Success = exports.Response = void 0;
|
4
|
+
const response_base_1 = require("../response-base");
|
5
|
+
/**
|
6
|
+
* Parent response type for a VectorSearch request. The
|
7
|
+
* response object is resolved to a type-safe object of one of
|
8
|
+
* the following subtypes:
|
9
|
+
*
|
10
|
+
* - {Success}
|
11
|
+
* - {Error}
|
12
|
+
*
|
13
|
+
* `instanceof` type guards can be used to operate on the appropriate subtype.
|
14
|
+
* @example
|
15
|
+
* For example:
|
16
|
+
* ```
|
17
|
+
* if (response instanceof VectorSearch.Error) {
|
18
|
+
* // Handle error as appropriate. The compiler will smart-cast `response` to type
|
19
|
+
* // `VectorSearch.Error` in this block, so you will have access to the properties
|
20
|
+
* // of the Error class; e.g. `response.errorCode()`.
|
21
|
+
* }
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
class Response extends response_base_1.ResponseBase {
|
25
|
+
hits() {
|
26
|
+
if (this instanceof Success) {
|
27
|
+
return this.hits();
|
28
|
+
}
|
29
|
+
return undefined;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
exports.Response = Response;
|
33
|
+
class _Success extends Response {
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* Indicates a Successful VectorSearch request.
|
37
|
+
*/
|
38
|
+
class Success extends (0, response_base_1.ResponseSuccess)(_Success) {
|
39
|
+
constructor(hits) {
|
40
|
+
super();
|
41
|
+
this._hits = hits;
|
42
|
+
}
|
43
|
+
hits() {
|
44
|
+
return this._hits;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
exports.Success = Success;
|
48
|
+
class _Error extends Response {
|
49
|
+
constructor(_innerException) {
|
50
|
+
super();
|
51
|
+
this._innerException = _innerException;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Indicates that an error occurred during the VectorSearch request.
|
56
|
+
*
|
57
|
+
* This response object includes the following fields that you can use to determine
|
58
|
+
* how you would like to handle the error:
|
59
|
+
*
|
60
|
+
* - `errorCode()` - a unique Momento error code indicating the type of error that occurred.
|
61
|
+
* - `message()` - a human-readable description of the error
|
62
|
+
* - `innerException()` - the original error that caused the failure; can be re-thrown.
|
63
|
+
*/
|
64
|
+
class Error extends (0, response_base_1.ResponseError)(_Error) {
|
65
|
+
}
|
66
|
+
exports.Error = Error;
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLXNlYXJjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9tZXNzYWdlcy9yZXNwb25zZXMvdmVjdG9yL3ZlY3Rvci1zZWFyY2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0Esb0RBQThFO0FBUTlFOzs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FrQkc7QUFDSCxNQUFzQixRQUFTLFNBQVEsNEJBQVk7SUFDakQsSUFBSTtRQUNGLElBQUksSUFBSSxZQUFZLE9BQU8sRUFBRTtZQUMzQixPQUFPLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQztTQUNwQjtRQUNELE9BQU8sU0FBUyxDQUFDO0lBQ25CLENBQUM7Q0FDRjtBQVBELDRCQU9DO0FBRUQsTUFBTSxRQUFTLFNBQVEsUUFBUTtDQUFHO0FBRWxDOztHQUVHO0FBQ0gsTUFBYSxPQUFRLFNBQVEsSUFBQSwrQkFBZSxFQUFDLFFBQVEsQ0FBQztJQUVwRCxZQUFZLElBQXNCO1FBQ2hDLEtBQUssRUFBRSxDQUFDO1FBQ1IsSUFBSSxDQUFDLEtBQUssR0FBRyxJQUFJLENBQUM7SUFDcEIsQ0FBQztJQUNELElBQUk7UUFDRixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDcEIsQ0FBQztDQUNGO0FBVEQsMEJBU0M7QUFFRCxNQUFNLE1BQU8sU0FBUSxRQUFRO0lBQzNCLFlBQXNCLGVBQXlCO1FBQzdDLEtBQUssRUFBRSxDQUFDO1FBRFksb0JBQWUsR0FBZixlQUFlLENBQVU7SUFFL0MsQ0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ICAgc3VwZXIoKTtcbiAgfVxufVxuXG4vKipcbiAqIEluZGljYXRlcyB0aGF0IGFuIGVycm9yIG9jY3VycmVkIGR1cmluZyB0aGUgVmVjdG9yU2VhcmNoIHJlcXVlc3QuXG4gKlxuICogVGhpcyByZXNwb25zZSBvYmplY3QgaW5jbHVkZXMgdGhlIGZvbGxvd2luZyBmaWVsZHMgdGhhdCB5b3UgY2FuIHVzZSB0byBkZXRlcm1pbmVcbiAqIGhvdyB5b3Ugd291bGQgbGlrZSB0byBoYW5kbGUgdGhlIGVycm9yOlxuICpcbiAqIC0gYGVycm9yQ29kZSgpYCAtIGEgdW5pcXVlIE1vbWVudG8gZXJyb3IgY29kZSBpbmRpY2F0aW5nIHRoZSB0eXBlIG9mIGVycm9yIHRoYXQgb2NjdXJyZWQuXG4gKiAtIGBtZXNzYWdlKClgIC0gYSBodW1hbi1yZWFkYWJsZSBkZXNjcmlwdGlvbiBvZiB0aGUgZXJyb3JcbiAqIC0gYGlubmVyRXhjZXB0aW9uKClgIC0gdGhlIG9yaWdpbmFsIGVycm9yIHRoYXQgY2F1c2VkIHRoZSBmYWlsdXJlOyBjYW4gYmUgcmUtdGhyb3duLlxuICovXG5leHBvcnQgY2xhc3MgRXJyb3IgZXh0ZW5kcyBSZXNwb25zZUVycm9yKF9FcnJvcikge31cbiJdfQ==
|
@@ -0,0 +1,3 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLWluZGV4LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL21lc3NhZ2VzL3ZlY3Rvci1pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBWZWN0b3JJbmRleEl0ZW0ge1xuICBpZDogc3RyaW5nO1xuICB2ZWN0b3I6IEFycmF5PG51bWJlcj47XG4gIG1ldGFkYXRhPzogUmVjb3JkPHN0cmluZywgc3RyaW5nPjtcbn1cbiJdfQ==
|