@infra-blocks/aws-dynamodb 0.38.0 → 0.39.0-alpha.1
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/lib/cjs/error.d.ts +25 -1
- package/lib/cjs/error.js +33 -39
- package/lib/cjs/error.js.map +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/native-client-errors.d.ts +1 -0
- package/lib/cjs/native-client-errors.js +45 -0
- package/lib/cjs/native-client-errors.js.map +1 -0
- package/lib/esm/error.d.ts +25 -1
- package/lib/esm/error.js +31 -3
- package/lib/esm/error.js.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/native-client-errors.d.ts +1 -0
- package/lib/esm/native-client-errors.js +7 -0
- package/lib/esm/native-client-errors.js.map +1 -0
- package/package.json +2 -2
package/lib/cjs/error.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
export { BackupInUseException, BackupNotFoundException, type BatchStatementError, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, type FailureException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
2
1
|
export declare class DynamoDbClientError extends Error {
|
|
3
2
|
constructor(message: string, options?: {
|
|
4
3
|
cause?: unknown;
|
|
5
4
|
});
|
|
6
5
|
}
|
|
6
|
+
export type TransactionCanceledCheck = {
|
|
7
|
+
index: number;
|
|
8
|
+
code: string;
|
|
9
|
+
};
|
|
10
|
+
export type TransactionCanceledCheckBuilder = {
|
|
11
|
+
atIndex(index: number): TransactionCanceledCheck;
|
|
12
|
+
};
|
|
13
|
+
export declare const ConditionalCheckFailed: TransactionCanceledCheckBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether the provided error is *caused* by a {@link TransactionCanceledException}
|
|
16
|
+
* with the given code at the given index as cancellation reason.
|
|
17
|
+
*
|
|
18
|
+
* It first starts by looking for a {@link TransactionCanceledException} in the causal chain
|
|
19
|
+
* using {@link @infra-blocks/error#findCauseByType}. If none is found, it returns false.
|
|
20
|
+
* If one is found, it returns whether the cancellation reason at the given index
|
|
21
|
+
* matches the given code.
|
|
22
|
+
*
|
|
23
|
+
* @param err - The error to inspect.
|
|
24
|
+
* @param params.index - The index amongst the cancellation reasons to inspect.
|
|
25
|
+
* @param params.code - The code to match against.
|
|
26
|
+
*
|
|
27
|
+
* @returns Whether the error is caused by a {@link TransactionCanceledException}
|
|
28
|
+
* with the given code at the given index as cancellation reason.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isTransactionCanceledBy(err: unknown, params: TransactionCanceledCheck): boolean;
|
package/lib/cjs/error.js
CHANGED
|
@@ -1,44 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "BackupInUseException", { enumerable: true, get: function () { return client_dynamodb_1.BackupInUseException; } });
|
|
8
|
-
Object.defineProperty(exports, "BackupNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.BackupNotFoundException; } });
|
|
9
|
-
Object.defineProperty(exports, "BatchStatementErrorCodeEnum", { enumerable: true, get: function () { return client_dynamodb_1.BatchStatementErrorCodeEnum; } });
|
|
10
|
-
Object.defineProperty(exports, "ConditionalCheckFailedException", { enumerable: true, get: function () { return client_dynamodb_1.ConditionalCheckFailedException; } });
|
|
11
|
-
Object.defineProperty(exports, "ContinuousBackupsUnavailableException", { enumerable: true, get: function () { return client_dynamodb_1.ContinuousBackupsUnavailableException; } });
|
|
12
|
-
Object.defineProperty(exports, "DuplicateItemException", { enumerable: true, get: function () { return client_dynamodb_1.DuplicateItemException; } });
|
|
13
|
-
Object.defineProperty(exports, "ExportConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ExportConflictException; } });
|
|
14
|
-
Object.defineProperty(exports, "ExportNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ExportNotFoundException; } });
|
|
15
|
-
Object.defineProperty(exports, "GlobalTableAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.GlobalTableAlreadyExistsException; } });
|
|
16
|
-
Object.defineProperty(exports, "GlobalTableNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.GlobalTableNotFoundException; } });
|
|
17
|
-
Object.defineProperty(exports, "IdempotentParameterMismatchException", { enumerable: true, get: function () { return client_dynamodb_1.IdempotentParameterMismatchException; } });
|
|
18
|
-
Object.defineProperty(exports, "ImportConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ImportConflictException; } });
|
|
19
|
-
Object.defineProperty(exports, "ImportNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ImportNotFoundException; } });
|
|
20
|
-
Object.defineProperty(exports, "IndexNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.IndexNotFoundException; } });
|
|
21
|
-
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return client_dynamodb_1.InternalServerError; } });
|
|
22
|
-
Object.defineProperty(exports, "InvalidEndpointException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidEndpointException; } });
|
|
23
|
-
Object.defineProperty(exports, "InvalidExportTimeException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidExportTimeException; } });
|
|
24
|
-
Object.defineProperty(exports, "InvalidRestoreTimeException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidRestoreTimeException; } });
|
|
25
|
-
Object.defineProperty(exports, "ItemCollectionSizeLimitExceededException", { enumerable: true, get: function () { return client_dynamodb_1.ItemCollectionSizeLimitExceededException; } });
|
|
26
|
-
Object.defineProperty(exports, "LimitExceededException", { enumerable: true, get: function () { return client_dynamodb_1.LimitExceededException; } });
|
|
27
|
-
Object.defineProperty(exports, "PointInTimeRecoveryUnavailableException", { enumerable: true, get: function () { return client_dynamodb_1.PointInTimeRecoveryUnavailableException; } });
|
|
28
|
-
Object.defineProperty(exports, "PolicyNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.PolicyNotFoundException; } });
|
|
29
|
-
Object.defineProperty(exports, "ProvisionedThroughputExceededException", { enumerable: true, get: function () { return client_dynamodb_1.ProvisionedThroughputExceededException; } });
|
|
30
|
-
Object.defineProperty(exports, "ReplicaAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicaAlreadyExistsException; } });
|
|
31
|
-
Object.defineProperty(exports, "ReplicaNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicaNotFoundException; } });
|
|
32
|
-
Object.defineProperty(exports, "ReplicatedWriteConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicatedWriteConflictException; } });
|
|
33
|
-
Object.defineProperty(exports, "RequestLimitExceeded", { enumerable: true, get: function () { return client_dynamodb_1.RequestLimitExceeded; } });
|
|
34
|
-
Object.defineProperty(exports, "ResourceInUseException", { enumerable: true, get: function () { return client_dynamodb_1.ResourceInUseException; } });
|
|
35
|
-
Object.defineProperty(exports, "ResourceNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ResourceNotFoundException; } });
|
|
36
|
-
Object.defineProperty(exports, "TableAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.TableAlreadyExistsException; } });
|
|
37
|
-
Object.defineProperty(exports, "TableInUseException", { enumerable: true, get: function () { return client_dynamodb_1.TableInUseException; } });
|
|
38
|
-
Object.defineProperty(exports, "TableNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.TableNotFoundException; } });
|
|
39
|
-
Object.defineProperty(exports, "TransactionCanceledException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionCanceledException; } });
|
|
40
|
-
Object.defineProperty(exports, "TransactionConflictException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionConflictException; } });
|
|
41
|
-
Object.defineProperty(exports, "TransactionInProgressException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionInProgressException; } });
|
|
3
|
+
exports.ConditionalCheckFailed = exports.DynamoDbClientError = void 0;
|
|
4
|
+
exports.isTransactionCanceledBy = isTransactionCanceledBy;
|
|
5
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
6
|
+
const error_1 = require("@infra-blocks/error");
|
|
42
7
|
class DynamoDbClientError extends Error {
|
|
43
8
|
constructor(message, options) {
|
|
44
9
|
super(message, options);
|
|
@@ -46,4 +11,33 @@ class DynamoDbClientError extends Error {
|
|
|
46
11
|
}
|
|
47
12
|
}
|
|
48
13
|
exports.DynamoDbClientError = DynamoDbClientError;
|
|
14
|
+
exports.ConditionalCheckFailed = {
|
|
15
|
+
atIndex(index) {
|
|
16
|
+
return { index, code: "ConditionalCheckFailed" };
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether the provided error is *caused* by a {@link TransactionCanceledException}
|
|
21
|
+
* with the given code at the given index as cancellation reason.
|
|
22
|
+
*
|
|
23
|
+
* It first starts by looking for a {@link TransactionCanceledException} in the causal chain
|
|
24
|
+
* using {@link @infra-blocks/error#findCauseByType}. If none is found, it returns false.
|
|
25
|
+
* If one is found, it returns whether the cancellation reason at the given index
|
|
26
|
+
* matches the given code.
|
|
27
|
+
*
|
|
28
|
+
* @param err - The error to inspect.
|
|
29
|
+
* @param params.index - The index amongst the cancellation reasons to inspect.
|
|
30
|
+
* @param params.code - The code to match against.
|
|
31
|
+
*
|
|
32
|
+
* @returns Whether the error is caused by a {@link TransactionCanceledException}
|
|
33
|
+
* with the given code at the given index as cancellation reason.
|
|
34
|
+
*/
|
|
35
|
+
function isTransactionCanceledBy(err, params) {
|
|
36
|
+
const { index, code } = params;
|
|
37
|
+
const transactionError = (0, error_1.findCauseByType)(err, client_dynamodb_1.TransactionCanceledException);
|
|
38
|
+
if (transactionError == null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return transactionError.CancellationReasons?.[index].Code === code;
|
|
42
|
+
}
|
|
49
43
|
//# sourceMappingURL=error.js.map
|
package/lib/cjs/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;AAyCA,0DAUC;AAnDD,8DAAwE;AACxE,+CAAsD;AAEtD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAWY,QAAA,sBAAsB,GAAoC;IACrE,OAAO,CAAC,KAAa;QACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IACnD,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,uBAAuB,CACrC,GAAY,EACZ,MAAgC;IAEhC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAA,uBAAe,EAAC,GAAG,EAAE,8CAA4B,CAAC,CAAC;IAC5E,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;AACrE,CAAC"}
|
package/lib/cjs/index.d.ts
CHANGED
package/lib/cjs/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./client.js"), exports);
|
|
18
18
|
__exportStar(require("./commands/index.js"), exports);
|
|
19
19
|
__exportStar(require("./error.js"), exports);
|
|
20
|
+
__exportStar(require("./native-client-errors.js"), exports);
|
|
20
21
|
__exportStar(require("./types.js"), exports);
|
|
21
22
|
__exportStar(require("./utils.js"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,sDAAoC;AACpC,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,sDAAoC;AACpC,6CAA2B;AAC3B,4DAA0C;AAC1C,6CAA2B;AAC3B,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BackupInUseException, BackupNotFoundException, type BatchStatementError, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, type FailureException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionInProgressException = exports.TransactionConflictException = exports.TransactionCanceledException = exports.TableNotFoundException = exports.TableInUseException = exports.TableAlreadyExistsException = exports.ResourceNotFoundException = exports.ResourceInUseException = exports.RequestLimitExceeded = exports.ReplicatedWriteConflictException = exports.ReplicaNotFoundException = exports.ReplicaAlreadyExistsException = exports.ProvisionedThroughputExceededException = exports.PolicyNotFoundException = exports.PointInTimeRecoveryUnavailableException = exports.LimitExceededException = exports.ItemCollectionSizeLimitExceededException = exports.InvalidRestoreTimeException = exports.InvalidExportTimeException = exports.InvalidEndpointException = exports.InternalServerError = exports.IndexNotFoundException = exports.ImportNotFoundException = exports.ImportConflictException = exports.IdempotentParameterMismatchException = exports.GlobalTableNotFoundException = exports.GlobalTableAlreadyExistsException = exports.ExportNotFoundException = exports.ExportConflictException = exports.DuplicateItemException = exports.ContinuousBackupsUnavailableException = exports.ConditionalCheckFailedException = exports.BatchStatementErrorCodeEnum = exports.BackupNotFoundException = exports.BackupInUseException = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Reexporting all those so client code does not have to install @aws-sdk/client-dynamodb just to check
|
|
6
|
+
for those errors. Those are missing the ThrottlingException and the ValidationException mentioned
|
|
7
|
+
in the documentations, but they aren't exported by the AWS package at the time of this writing.
|
|
8
|
+
*/
|
|
9
|
+
var client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
10
|
+
Object.defineProperty(exports, "BackupInUseException", { enumerable: true, get: function () { return client_dynamodb_1.BackupInUseException; } });
|
|
11
|
+
Object.defineProperty(exports, "BackupNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.BackupNotFoundException; } });
|
|
12
|
+
Object.defineProperty(exports, "BatchStatementErrorCodeEnum", { enumerable: true, get: function () { return client_dynamodb_1.BatchStatementErrorCodeEnum; } });
|
|
13
|
+
Object.defineProperty(exports, "ConditionalCheckFailedException", { enumerable: true, get: function () { return client_dynamodb_1.ConditionalCheckFailedException; } });
|
|
14
|
+
Object.defineProperty(exports, "ContinuousBackupsUnavailableException", { enumerable: true, get: function () { return client_dynamodb_1.ContinuousBackupsUnavailableException; } });
|
|
15
|
+
Object.defineProperty(exports, "DuplicateItemException", { enumerable: true, get: function () { return client_dynamodb_1.DuplicateItemException; } });
|
|
16
|
+
Object.defineProperty(exports, "ExportConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ExportConflictException; } });
|
|
17
|
+
Object.defineProperty(exports, "ExportNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ExportNotFoundException; } });
|
|
18
|
+
Object.defineProperty(exports, "GlobalTableAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.GlobalTableAlreadyExistsException; } });
|
|
19
|
+
Object.defineProperty(exports, "GlobalTableNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.GlobalTableNotFoundException; } });
|
|
20
|
+
Object.defineProperty(exports, "IdempotentParameterMismatchException", { enumerable: true, get: function () { return client_dynamodb_1.IdempotentParameterMismatchException; } });
|
|
21
|
+
Object.defineProperty(exports, "ImportConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ImportConflictException; } });
|
|
22
|
+
Object.defineProperty(exports, "ImportNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ImportNotFoundException; } });
|
|
23
|
+
Object.defineProperty(exports, "IndexNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.IndexNotFoundException; } });
|
|
24
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return client_dynamodb_1.InternalServerError; } });
|
|
25
|
+
Object.defineProperty(exports, "InvalidEndpointException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidEndpointException; } });
|
|
26
|
+
Object.defineProperty(exports, "InvalidExportTimeException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidExportTimeException; } });
|
|
27
|
+
Object.defineProperty(exports, "InvalidRestoreTimeException", { enumerable: true, get: function () { return client_dynamodb_1.InvalidRestoreTimeException; } });
|
|
28
|
+
Object.defineProperty(exports, "ItemCollectionSizeLimitExceededException", { enumerable: true, get: function () { return client_dynamodb_1.ItemCollectionSizeLimitExceededException; } });
|
|
29
|
+
Object.defineProperty(exports, "LimitExceededException", { enumerable: true, get: function () { return client_dynamodb_1.LimitExceededException; } });
|
|
30
|
+
Object.defineProperty(exports, "PointInTimeRecoveryUnavailableException", { enumerable: true, get: function () { return client_dynamodb_1.PointInTimeRecoveryUnavailableException; } });
|
|
31
|
+
Object.defineProperty(exports, "PolicyNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.PolicyNotFoundException; } });
|
|
32
|
+
Object.defineProperty(exports, "ProvisionedThroughputExceededException", { enumerable: true, get: function () { return client_dynamodb_1.ProvisionedThroughputExceededException; } });
|
|
33
|
+
Object.defineProperty(exports, "ReplicaAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicaAlreadyExistsException; } });
|
|
34
|
+
Object.defineProperty(exports, "ReplicaNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicaNotFoundException; } });
|
|
35
|
+
Object.defineProperty(exports, "ReplicatedWriteConflictException", { enumerable: true, get: function () { return client_dynamodb_1.ReplicatedWriteConflictException; } });
|
|
36
|
+
Object.defineProperty(exports, "RequestLimitExceeded", { enumerable: true, get: function () { return client_dynamodb_1.RequestLimitExceeded; } });
|
|
37
|
+
Object.defineProperty(exports, "ResourceInUseException", { enumerable: true, get: function () { return client_dynamodb_1.ResourceInUseException; } });
|
|
38
|
+
Object.defineProperty(exports, "ResourceNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.ResourceNotFoundException; } });
|
|
39
|
+
Object.defineProperty(exports, "TableAlreadyExistsException", { enumerable: true, get: function () { return client_dynamodb_1.TableAlreadyExistsException; } });
|
|
40
|
+
Object.defineProperty(exports, "TableInUseException", { enumerable: true, get: function () { return client_dynamodb_1.TableInUseException; } });
|
|
41
|
+
Object.defineProperty(exports, "TableNotFoundException", { enumerable: true, get: function () { return client_dynamodb_1.TableNotFoundException; } });
|
|
42
|
+
Object.defineProperty(exports, "TransactionCanceledException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionCanceledException; } });
|
|
43
|
+
Object.defineProperty(exports, "TransactionConflictException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionConflictException; } });
|
|
44
|
+
Object.defineProperty(exports, "TransactionInProgressException", { enumerable: true, get: function () { return client_dynamodb_1.TransactionInProgressException; } });
|
|
45
|
+
//# sourceMappingURL=native-client-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-client-errors.js","sourceRoot":"","sources":["../../src/native-client-errors.ts"],"names":[],"mappings":";;;AAAA;;;;EAIE;AACF,4DAsCkC;AArChC,uHAAA,oBAAoB,OAAA;AACpB,0HAAA,uBAAuB,OAAA;AAEvB,8HAAA,2BAA2B,OAAA;AAC3B,kIAAA,+BAA+B,OAAA;AAC/B,wIAAA,qCAAqC,OAAA;AACrC,yHAAA,sBAAsB,OAAA;AACtB,0HAAA,uBAAuB,OAAA;AACvB,0HAAA,uBAAuB,OAAA;AAEvB,oIAAA,iCAAiC,OAAA;AACjC,+HAAA,4BAA4B,OAAA;AAC5B,uIAAA,oCAAoC,OAAA;AACpC,0HAAA,uBAAuB,OAAA;AACvB,0HAAA,uBAAuB,OAAA;AACvB,yHAAA,sBAAsB,OAAA;AACtB,sHAAA,mBAAmB,OAAA;AACnB,2HAAA,wBAAwB,OAAA;AACxB,6HAAA,0BAA0B,OAAA;AAC1B,8HAAA,2BAA2B,OAAA;AAC3B,2IAAA,wCAAwC,OAAA;AACxC,yHAAA,sBAAsB,OAAA;AACtB,0IAAA,uCAAuC,OAAA;AACvC,0HAAA,uBAAuB,OAAA;AACvB,yIAAA,sCAAsC,OAAA;AACtC,gIAAA,6BAA6B,OAAA;AAC7B,2HAAA,wBAAwB,OAAA;AACxB,mIAAA,gCAAgC,OAAA;AAChC,uHAAA,oBAAoB,OAAA;AACpB,yHAAA,sBAAsB,OAAA;AACtB,4HAAA,yBAAyB,OAAA;AACzB,8HAAA,2BAA2B,OAAA;AAC3B,sHAAA,mBAAmB,OAAA;AACnB,yHAAA,sBAAsB,OAAA;AACtB,+HAAA,4BAA4B,OAAA;AAC5B,+HAAA,4BAA4B,OAAA;AAC5B,iIAAA,8BAA8B,OAAA"}
|
package/lib/esm/error.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
export { BackupInUseException, BackupNotFoundException, type BatchStatementError, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, type FailureException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
2
1
|
export declare class DynamoDbClientError extends Error {
|
|
3
2
|
constructor(message: string, options?: {
|
|
4
3
|
cause?: unknown;
|
|
5
4
|
});
|
|
6
5
|
}
|
|
6
|
+
export type TransactionCanceledCheck = {
|
|
7
|
+
index: number;
|
|
8
|
+
code: string;
|
|
9
|
+
};
|
|
10
|
+
export type TransactionCanceledCheckBuilder = {
|
|
11
|
+
atIndex(index: number): TransactionCanceledCheck;
|
|
12
|
+
};
|
|
13
|
+
export declare const ConditionalCheckFailed: TransactionCanceledCheckBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether the provided error is *caused* by a {@link TransactionCanceledException}
|
|
16
|
+
* with the given code at the given index as cancellation reason.
|
|
17
|
+
*
|
|
18
|
+
* It first starts by looking for a {@link TransactionCanceledException} in the causal chain
|
|
19
|
+
* using {@link @infra-blocks/error#findCauseByType}. If none is found, it returns false.
|
|
20
|
+
* If one is found, it returns whether the cancellation reason at the given index
|
|
21
|
+
* matches the given code.
|
|
22
|
+
*
|
|
23
|
+
* @param err - The error to inspect.
|
|
24
|
+
* @param params.index - The index amongst the cancellation reasons to inspect.
|
|
25
|
+
* @param params.code - The code to match against.
|
|
26
|
+
*
|
|
27
|
+
* @returns Whether the error is caused by a {@link TransactionCanceledException}
|
|
28
|
+
* with the given code at the given index as cancellation reason.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isTransactionCanceledBy(err: unknown, params: TransactionCanceledCheck): boolean;
|
package/lib/esm/error.js
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { BackupInUseException, BackupNotFoundException, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
1
|
+
import { TransactionCanceledException } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
import { findCauseByType } from "@infra-blocks/error";
|
|
4
3
|
export class DynamoDbClientError extends Error {
|
|
5
4
|
constructor(message, options) {
|
|
6
5
|
super(message, options);
|
|
7
6
|
this.name = "DynamoDbClientError";
|
|
8
7
|
}
|
|
9
8
|
}
|
|
9
|
+
export const ConditionalCheckFailed = {
|
|
10
|
+
atIndex(index) {
|
|
11
|
+
return { index, code: "ConditionalCheckFailed" };
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether the provided error is *caused* by a {@link TransactionCanceledException}
|
|
16
|
+
* with the given code at the given index as cancellation reason.
|
|
17
|
+
*
|
|
18
|
+
* It first starts by looking for a {@link TransactionCanceledException} in the causal chain
|
|
19
|
+
* using {@link @infra-blocks/error#findCauseByType}. If none is found, it returns false.
|
|
20
|
+
* If one is found, it returns whether the cancellation reason at the given index
|
|
21
|
+
* matches the given code.
|
|
22
|
+
*
|
|
23
|
+
* @param err - The error to inspect.
|
|
24
|
+
* @param params.index - The index amongst the cancellation reasons to inspect.
|
|
25
|
+
* @param params.code - The code to match against.
|
|
26
|
+
*
|
|
27
|
+
* @returns Whether the error is caused by a {@link TransactionCanceledException}
|
|
28
|
+
* with the given code at the given index as cancellation reason.
|
|
29
|
+
*/
|
|
30
|
+
export function isTransactionCanceledBy(err, params) {
|
|
31
|
+
const { index, code } = params;
|
|
32
|
+
const transactionError = findCauseByType(err, TransactionCanceledException);
|
|
33
|
+
if (transactionError == null) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return transactionError.CancellationReasons?.[index].Code === code;
|
|
37
|
+
}
|
|
10
38
|
//# sourceMappingURL=error.js.map
|
package/lib/esm/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAWD,MAAM,CAAC,MAAM,sBAAsB,GAAoC;IACrE,OAAO,CAAC,KAAa;QACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IACnD,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAY,EACZ,MAAgC;IAEhC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;IAC5E,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;AACrE,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BackupInUseException, BackupNotFoundException, type BatchStatementError, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, type FailureException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Reexporting all those so client code does not have to install @aws-sdk/client-dynamodb just to check
|
|
3
|
+
for those errors. Those are missing the ThrottlingException and the ValidationException mentioned
|
|
4
|
+
in the documentations, but they aren't exported by the AWS package at the time of this writing.
|
|
5
|
+
*/
|
|
6
|
+
export { BackupInUseException, BackupNotFoundException, BatchStatementErrorCodeEnum, ConditionalCheckFailedException, ContinuousBackupsUnavailableException, DuplicateItemException, ExportConflictException, ExportNotFoundException, GlobalTableAlreadyExistsException, GlobalTableNotFoundException, IdempotentParameterMismatchException, ImportConflictException, ImportNotFoundException, IndexNotFoundException, InternalServerError, InvalidEndpointException, InvalidExportTimeException, InvalidRestoreTimeException, ItemCollectionSizeLimitExceededException, LimitExceededException, PointInTimeRecoveryUnavailableException, PolicyNotFoundException, ProvisionedThroughputExceededException, ReplicaAlreadyExistsException, ReplicaNotFoundException, ReplicatedWriteConflictException, RequestLimitExceeded, ResourceInUseException, ResourceNotFoundException, TableAlreadyExistsException, TableInUseException, TableNotFoundException, TransactionCanceledException, TransactionConflictException, TransactionInProgressException, } from "@aws-sdk/client-dynamodb";
|
|
7
|
+
//# sourceMappingURL=native-client-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-client-errors.js","sourceRoot":"","sources":["../../src/native-client-errors.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AACF,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EAEvB,2BAA2B,EAC3B,+BAA+B,EAC/B,qCAAqC,EACrC,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EAEvB,iCAAiC,EACjC,4BAA4B,EAC5B,oCAAoC,EACpC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,wCAAwC,EACxC,sBAAsB,EACtB,uCAAuC,EACvC,uBAAuB,EACvB,sCAAsC,EACtC,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,EAChC,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/aws-dynamodb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0-alpha.1",
|
|
4
4
|
"description": "A convenience wrapper over @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "^2.1.2",
|
|
44
44
|
"@infra-blocks/checks": "^0.2.7",
|
|
45
|
-
"@infra-blocks/error": "^0.1.0",
|
|
46
45
|
"@infra-blocks/iter": "^0.2.7",
|
|
47
46
|
"@infra-blocks/node-console-logger": "^0.3.1",
|
|
48
47
|
"@infra-blocks/test": "^0.4.0",
|
|
@@ -63,6 +62,7 @@
|
|
|
63
62
|
"dependencies": {
|
|
64
63
|
"@aws-sdk/client-dynamodb": "^3.840.0",
|
|
65
64
|
"@aws-sdk/lib-dynamodb": "^3.840.0",
|
|
65
|
+
"@infra-blocks/error": "^0.2.0",
|
|
66
66
|
"@infra-blocks/logger-interface": "^0.3.1",
|
|
67
67
|
"@infra-blocks/null-logger": "^0.1.1",
|
|
68
68
|
"@infra-blocks/retry": "^0.1.1",
|