qstd 0.3.87 → 0.3.89
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.
|
@@ -5,6 +5,21 @@ import * as _t from "./types";
|
|
|
5
5
|
* @throws Error if no table name is found
|
|
6
6
|
*/
|
|
7
7
|
export declare const getTableNameOrThrow: (...candidates: (string | undefined)[]) => string;
|
|
8
|
+
/**
|
|
9
|
+
* DynamoDB transact writes can fail because another writer touched one of the
|
|
10
|
+
* same items at the same time.
|
|
11
|
+
*
|
|
12
|
+
* Callers usually want to retry that specific case, but they should still let
|
|
13
|
+
* every other DynamoDB failure surface immediately.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isTransactionConflictError: (error: unknown) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Conditional writes fail when another writer changed the guarded row first.
|
|
18
|
+
*
|
|
19
|
+
* Callers usually want to re-read and retry that case, while still surfacing
|
|
20
|
+
* genuine validation or infrastructure failures immediately.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isConditionalConflictError: (error: unknown) => boolean;
|
|
8
23
|
export declare const validateFindProps: <T extends object = Record<string, unknown>>(props: _t.FindProps<T> & {
|
|
9
24
|
first?: boolean;
|
|
10
25
|
raw?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/ddb/fns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/ddb/fns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAuB9B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,G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,MAAM,KAAG,MAE9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,MAAM,KAAG,CAAC,EAAE,EAIpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAC3B,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,QAAQ,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,uBA6I7C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./domain";
|
|
2
2
|
export * from "./literals";
|
|
3
|
+
export { isConditionalConflictError, isTransactionConflictError } from "./fns";
|
|
3
4
|
export { copyTable } from "./copy-table";
|
|
4
5
|
export type { Key, TransactItem, TransactPut, TransactDelete, TransactUpdate, TransactConditionCheck, TransactResult, } from "./types";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/ddb/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EACV,GAAG,EACH,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/ddb/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EACV,GAAG,EACH,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
package/dist/server/index.cjs
CHANGED
|
@@ -1529,6 +1529,8 @@ __export(ddb_exports, {
|
|
|
1529
1529
|
create: () => create3,
|
|
1530
1530
|
deleteTable: () => deleteTable,
|
|
1531
1531
|
find: () => find,
|
|
1532
|
+
isConditionalConflictError: () => isConditionalConflictError,
|
|
1533
|
+
isTransactionConflictError: () => isTransactionConflictError,
|
|
1532
1534
|
lsi1: () => lsi1,
|
|
1533
1535
|
lsi2: () => lsi2,
|
|
1534
1536
|
lsi3: () => lsi3,
|
|
@@ -1542,6 +1544,10 @@ __export(ddb_exports, {
|
|
|
1542
1544
|
});
|
|
1543
1545
|
|
|
1544
1546
|
// src/server/aws/ddb/fns.ts
|
|
1547
|
+
var getErrorNameAndMessage = (error2) => ({
|
|
1548
|
+
errorName: error2 instanceof Error ? error2.name : typeof error2 === "object" && error2 && "name" in error2 && typeof error2.name === "string" ? error2.name : "",
|
|
1549
|
+
errorMessage: error2 instanceof Error ? error2.message : typeof error2 === "object" && error2 && "message" in error2 && typeof error2.message === "string" ? error2.message : ""
|
|
1550
|
+
});
|
|
1545
1551
|
var getTableNameOrThrow = (...candidates) => {
|
|
1546
1552
|
for (const name of candidates) {
|
|
1547
1553
|
if (name) return name;
|
|
@@ -1550,6 +1556,16 @@ var getTableNameOrThrow = (...candidates) => {
|
|
|
1550
1556
|
`[ddb] "tableName" is required - provide it in props or when creating the client`
|
|
1551
1557
|
);
|
|
1552
1558
|
};
|
|
1559
|
+
var isTransactionConflictError = (error2) => {
|
|
1560
|
+
const { errorMessage, errorName } = getErrorNameAndMessage(error2);
|
|
1561
|
+
return errorName === "TransactionConflictException" || errorName === "TransactionCanceledException" || /TransactionConflict|Transaction cancelled/i.test(errorMessage);
|
|
1562
|
+
};
|
|
1563
|
+
var isConditionalConflictError = (error2) => {
|
|
1564
|
+
const { errorMessage, errorName } = getErrorNameAndMessage(error2);
|
|
1565
|
+
return errorName === "ConditionalCheckFailedException" || /ConditionalCheckFailed|conditional check failed|conditional request failed/i.test(
|
|
1566
|
+
errorMessage
|
|
1567
|
+
);
|
|
1568
|
+
};
|
|
1553
1569
|
var validateFindProps = (props, tableName) => {
|
|
1554
1570
|
const isScan = "scan" in props && props.scan === true;
|
|
1555
1571
|
if (!tableName) {
|
package/dist/server/index.js
CHANGED
|
@@ -1521,6 +1521,8 @@ __export(ddb_exports, {
|
|
|
1521
1521
|
create: () => create3,
|
|
1522
1522
|
deleteTable: () => deleteTable,
|
|
1523
1523
|
find: () => find,
|
|
1524
|
+
isConditionalConflictError: () => isConditionalConflictError,
|
|
1525
|
+
isTransactionConflictError: () => isTransactionConflictError,
|
|
1524
1526
|
lsi1: () => lsi1,
|
|
1525
1527
|
lsi2: () => lsi2,
|
|
1526
1528
|
lsi3: () => lsi3,
|
|
@@ -1534,6 +1536,10 @@ __export(ddb_exports, {
|
|
|
1534
1536
|
});
|
|
1535
1537
|
|
|
1536
1538
|
// src/server/aws/ddb/fns.ts
|
|
1539
|
+
var getErrorNameAndMessage = (error2) => ({
|
|
1540
|
+
errorName: error2 instanceof Error ? error2.name : typeof error2 === "object" && error2 && "name" in error2 && typeof error2.name === "string" ? error2.name : "",
|
|
1541
|
+
errorMessage: error2 instanceof Error ? error2.message : typeof error2 === "object" && error2 && "message" in error2 && typeof error2.message === "string" ? error2.message : ""
|
|
1542
|
+
});
|
|
1537
1543
|
var getTableNameOrThrow = (...candidates) => {
|
|
1538
1544
|
for (const name of candidates) {
|
|
1539
1545
|
if (name) return name;
|
|
@@ -1542,6 +1548,16 @@ var getTableNameOrThrow = (...candidates) => {
|
|
|
1542
1548
|
`[ddb] "tableName" is required - provide it in props or when creating the client`
|
|
1543
1549
|
);
|
|
1544
1550
|
};
|
|
1551
|
+
var isTransactionConflictError = (error2) => {
|
|
1552
|
+
const { errorMessage, errorName } = getErrorNameAndMessage(error2);
|
|
1553
|
+
return errorName === "TransactionConflictException" || errorName === "TransactionCanceledException" || /TransactionConflict|Transaction cancelled/i.test(errorMessage);
|
|
1554
|
+
};
|
|
1555
|
+
var isConditionalConflictError = (error2) => {
|
|
1556
|
+
const { errorMessage, errorName } = getErrorNameAndMessage(error2);
|
|
1557
|
+
return errorName === "ConditionalCheckFailedException" || /ConditionalCheckFailed|conditional check failed|conditional request failed/i.test(
|
|
1558
|
+
errorMessage
|
|
1559
|
+
);
|
|
1560
|
+
};
|
|
1545
1561
|
var validateFindProps = (props, tableName) => {
|
|
1546
1562
|
const isScan = "scan" in props && props.scan === true;
|
|
1547
1563
|
if (!tableName) {
|