@noldova/context.data 0.0.7 → 0.0.9
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/api/index.d.ts +8 -12
- package/exceptions/data.exception.js +0 -1
- package/exceptions/data.exception.js.map +1 -1
- package/models/connection.js +1 -1
- package/package.json +5 -5
- package/resources.js +1 -1
- package/resources.js.map +1 -1
package/api/index.d.ts
CHANGED
|
@@ -40,12 +40,6 @@ export declare enum ChangeOperation {
|
|
|
40
40
|
* order.
|
|
41
41
|
*/
|
|
42
42
|
export declare class DataException extends Exception {
|
|
43
|
-
/**
|
|
44
|
-
* The exception's name, `"DataException"`, which the class sets itself so
|
|
45
|
-
* that it stays the same in a minified build.
|
|
46
|
-
*/
|
|
47
|
-
public override readonly name: string;
|
|
48
|
-
|
|
49
43
|
/**
|
|
50
44
|
* Initializes the exception with a message and optional options carrying
|
|
51
45
|
* the cause.
|
|
@@ -250,8 +244,9 @@ export declare abstract class Transaction implements AsyncDisposable {
|
|
|
250
244
|
public get isCompleted(): boolean;
|
|
251
245
|
|
|
252
246
|
/**
|
|
253
|
-
* True once a nested action
|
|
254
|
-
* back, even when its outer
|
|
247
|
+
* True once a nested action, or a statement a store kind runs in it,
|
|
248
|
+
* failed: the transaction can then only roll back, even when its outer
|
|
249
|
+
* action swallowed the failure.
|
|
255
250
|
*/
|
|
256
251
|
public get isRollbackOnly(): boolean;
|
|
257
252
|
|
|
@@ -365,10 +360,11 @@ export declare abstract class Connection<TTransaction extends Transaction = Tran
|
|
|
365
360
|
* operations have ended: committed when its promise fulfills, rolled back
|
|
366
361
|
* when it rejects, and the action's exception is rethrown. The action
|
|
367
362
|
* receives the transaction; nest through its `runInTransactionAsync`. A nested
|
|
368
|
-
* failure
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* the
|
|
363
|
+
* failure, or a statement that failed in the transaction, rolls the
|
|
364
|
+
* transaction back, with `DataException` when the outer action swallowed
|
|
365
|
+
* it. A failed commit also triggers rollback. If the action or commit and
|
|
366
|
+
* the rollback both fail, a `SuppressedError` retains the original failure
|
|
367
|
+
* in `suppressed` and the rollback failure in `error`.
|
|
372
368
|
* A closed connection rejects with `DataException`.
|
|
373
369
|
*
|
|
374
370
|
* Never call the connection inside an action: use the transaction the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.exception.js","sourceRoot":"","sources":["../../../../src/data/noldova.context.data/src/exceptions/data.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,6BAA6B,CAAC;AAE/E,MAAM,OAAO,aAAc,SAAQ,SAAS;
|
|
1
|
+
{"version":3,"file":"data.exception.js","sourceRoot":"","sources":["../../../../src/data/noldova.context.data/src/exceptions/data.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,6BAA6B,CAAC;AAE/E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAmB,OAAe,EAAE,OAA0B;QAC5D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
package/models/connection.js
CHANGED
|
@@ -42,7 +42,7 @@ export class Connection {
|
|
|
42
42
|
try {
|
|
43
43
|
const result = await action(transaction);
|
|
44
44
|
if (transaction.isRollbackOnly)
|
|
45
|
-
throw new DataException(Resources.
|
|
45
|
+
throw new DataException(Resources.transactionFailedInside);
|
|
46
46
|
await transaction.commitAsync();
|
|
47
47
|
return result;
|
|
48
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noldova/context.data",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "api/index.js",
|
|
6
6
|
"types": "api/index.d.ts",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"access": "public",
|
|
19
19
|
"registry": "https://registry.npmjs.org/"
|
|
20
20
|
},
|
|
21
|
-
"
|
|
22
|
-
"@noldova/context.core": "0.0.
|
|
23
|
-
"@noldova/context.exceptions": "0.0.
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@noldova/context.core": ">=0.0.9 <0.1.0",
|
|
23
|
+
"@noldova/context.exceptions": ">=0.0.9 <0.1.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "739f94fdfd82cfca7901164d7719be5275012451"
|
|
26
26
|
}
|
package/resources.js
CHANGED
|
@@ -21,9 +21,9 @@ export class Resources {
|
|
|
21
21
|
static migrationIdPattern = /^\d{14}_[A-Z][A-Za-z0-9]*$/;
|
|
22
22
|
static migrationsUnordered = "Migrations are listed once each, in ascending id order.";
|
|
23
23
|
static nameParameterName = "name";
|
|
24
|
-
static nestedTransactionFailed = "An inner transaction failed, so the outer transaction was rolled back.";
|
|
25
24
|
static sequenceParameterName = "sequence";
|
|
26
25
|
static transactionCompleted = "The transaction has already been committed or rolled back.";
|
|
26
|
+
static transactionFailedInside = "A statement or an inner transaction failed, so the transaction was rolled back.";
|
|
27
27
|
static transactionRollbackFailed = "The transaction failed and rollback also failed.";
|
|
28
28
|
static formatFieldMissing(field) {
|
|
29
29
|
return `The record has no field "${field}".`;
|
package/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/data/noldova.context.data/src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,SAAS;IACb,MAAM,CAAU,gBAAgB,GAAW,2BAA2B,CAAC;IACvE,MAAM,CAAU,sBAAsB,GAAW,WAAW,CAAC;IAC7D,MAAM,CAAU,sBAAsB,GAAW,WAAW,CAAC;IAC7D,MAAM,CAAU,kBAAkB,GAAW,GAAG,CAAC;IACjD,MAAM,CAAU,qBAAqB,GAAW,UAAU,CAAC;IAC3D,MAAM,C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