@noldova/context.data 0.0.8 → 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 CHANGED
@@ -244,8 +244,9 @@ export declare abstract class Transaction implements AsyncDisposable {
244
244
  public get isCompleted(): boolean;
245
245
 
246
246
  /**
247
- * True once a nested action failed: the transaction can then only roll
248
- * back, even when its outer action swallowed the failure.
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.
249
250
  */
250
251
  public get isRollbackOnly(): boolean;
251
252
 
@@ -359,10 +360,11 @@ export declare abstract class Connection<TTransaction extends Transaction = Tran
359
360
  * operations have ended: committed when its promise fulfills, rolled back
360
361
  * when it rejects, and the action's exception is rethrown. The action
361
362
  * receives the transaction; nest through its `runInTransactionAsync`. A nested
362
- * failure rolls the transaction back, with `DataException` when the outer
363
- * action swallowed it. A failed commit also triggers rollback. If the
364
- * action or commit and the rollback both fail, a `SuppressedError` retains
365
- * the original failure in `suppressed` and the rollback failure in `error`.
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`.
366
368
  * A closed connection rejects with `DataException`.
367
369
  *
368
370
  * Never call the connection inside an action: use the transaction the
@@ -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.nestedTransactionFailed);
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.8",
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
- "dependencies": {
22
- "@noldova/context.core": "0.0.8",
23
- "@noldova/context.exceptions": "0.0.8"
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": "423435425245d53189d2da44155a6cd66ac0b1f1"
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,CAAU,mBAAmB,GAAW,QAAQ,CAAC;IACvD,MAAM,CAAU,mBAAmB,GAAW,QAAQ,CAAC;IACvD,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