@axinom/mosaic-service-common 0.53.0-rc.9 → 0.53.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.
@@ -1 +1 @@
1
- {"version":3,"file":"default-pg-error-mapper.d.ts","sourceRoot":"","sources":["../../../src/common/errors/default-pg-error-mapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,eAAe,CAyEnE,CAAC"}
1
+ {"version":3,"file":"default-pg-error-mapper.d.ts","sourceRoot":"","sources":["../../../src/common/errors/default-pg-error-mapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,eAAe,CAwEnE,CAAC"}
@@ -29,10 +29,9 @@ const defaultPgErrorMapper = (error, defaultError) => {
29
29
  code: mosaic_errors_1.MosaicErrors.DatabaseValidationFailed.code,
30
30
  };
31
31
  case pg_error_code_1.PgErrorCode.UniqueConstraintError:
32
- return {
33
- message: `Attempt to create or update an element failed, as it would have resulted in a duplicate element.`,
34
- code: mosaic_errors_1.MosaicErrors.DatabaseValidationFailed.code,
35
- };
32
+ // More specific mapping of constraint error to a readable message is
33
+ // expected to be done by individual services.
34
+ return mosaic_errors_1.MosaicErrors.UniqueConstraintError;
36
35
  case pg_error_code_1.PgErrorCode.NotNullConstraintError:
37
36
  return {
38
37
  message: `The '${(0, helpers_1.isNullOrWhitespace)(originalError === null || originalError === void 0 ? void 0 : originalError.column)
@@ -1 +1 @@
1
- {"version":3,"file":"default-pg-error-mapper.js","sourceRoot":"","sources":["../../../src/common/errors/default-pg-error-mapper.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AACtC,wCAAgD;AAChD,mDAA+C;AA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,wBAAwB,CAAC;QAC1C,KAAK,2BAAW,CAAC,kBAAkB,CAAC;QACpC,KAAK,2BAAW,CAAC,kBAAkB,CAAC;QACpC,KAAK,2BAAW,CAAC,gCAAgC,CAAC;QAClD,KAAK,2BAAW,CAAC,qCAAqC,CAAC;QACvD,KAAK,2BAAW,CAAC,sBAAsB,CAAC;QACxC,KAAK,2BAAW,CAAC,8BAA8B,CAAC;QAChD,KAAK,2BAAW,CAAC,iCAAiC,CAAC;QACnD,KAAK,2BAAW,CAAC,wCAAwC,CAAC;QAC1D,KAAK,2BAAW,CAAC,yBAAyB,CAAC;QAC3C,KAAK,2BAAW,CAAC,8BAA8B,CAAC;QAChD,KAAK,2BAAW,CAAC,6BAA6B;YAC5C,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,wBAAwB,CAAC,IAAI;aACjD,CAAC;QACJ,KAAK,2BAAW,CAAC,2BAA2B,CAAC,CAAC;YAC5C,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,8BAA8B,CAAC,IAAI;aACvD,CAAC;SACH;QACD,KAAK,2BAAW,CAAC,oBAAoB,CAAC,CAAC;YACrC,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,sBAAsB,CAAC,IAAI;aAC/C,CAAC;SACH;QACD,KAAK,2BAAW,CAAC,gBAAgB,CAAC,CAAC;YACjC,OAAO,4BAAY,CAAC,wBAAwB,CAAC;SAC9C;QACD;YACE,OAAO,4BAAY,CAAC,sBAAsB,CAAC;KAC9C;AACH,CAAC,CAAC;AAzEW,QAAA,oBAAoB,wBAyE/B"}
1
+ {"version":3,"file":"default-pg-error-mapper.js","sourceRoot":"","sources":["../../../src/common/errors/default-pg-error-mapper.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AACtC,wCAAgD;AAChD,mDAA+C;AAC/C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AAC,kBAAkB,CAAC;QACpC,KAAK,2BAAW,CAAC,kBAAkB,CAAC;QACpC,KAAK,2BAAW,CAAC,gCAAgC,CAAC;QAClD,KAAK,2BAAW,CAAC,qCAAqC,CAAC;QACvD,KAAK,2BAAW,CAAC,sBAAsB,CAAC;QACxC,KAAK,2BAAW,CAAC,8BAA8B,CAAC;QAChD,KAAK,2BAAW,CAAC,iCAAiC,CAAC;QACnD,KAAK,2BAAW,CAAC,wCAAwC,CAAC;QAC1D,KAAK,2BAAW,CAAC,yBAAyB,CAAC;QAC3C,KAAK,2BAAW,CAAC,8BAA8B,CAAC;QAChD,KAAK,2BAAW,CAAC,6BAA6B;YAC5C,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,wBAAwB,CAAC,IAAI;aACjD,CAAC;QACJ,KAAK,2BAAW,CAAC,2BAA2B,CAAC,CAAC;YAC5C,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,8BAA8B,CAAC,IAAI;aACvD,CAAC;SACH;QACD,KAAK,2BAAW,CAAC,oBAAoB,CAAC,CAAC;YACrC,OAAO;gBACL,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,4BAAY,CAAC,sBAAsB,CAAC,IAAI;aAC/C,CAAC;SACH;QACD,KAAK,2BAAW,CAAC,gBAAgB,CAAC,CAAC;YACjC,OAAO,4BAAY,CAAC,wBAAwB,CAAC;SAC9C;QACD;YACE,OAAO,4BAAY,CAAC,sBAAsB,CAAC;KAC9C;AACH,CAAC,CAAC;AAxEW,QAAA,oBAAoB,wBAwE/B"}
@@ -20,6 +20,10 @@ export declare const MosaicErrors: {
20
20
  readonly message: "An expected and handled database constraint error has occurred. The actual message will have more information.";
21
21
  readonly code: "DATABASE_VALIDATION_FAILED";
22
22
  };
23
+ readonly UniqueConstraintError: {
24
+ readonly message: "Attempt to create or update an element failed, as it would have resulted in a duplicate element.";
25
+ readonly code: "UNIQUE_CONSTRAINT_ERROR";
26
+ };
23
27
  readonly DatabasePermissionsCheckFailed: {
24
28
  readonly message: "An authorization database error has occurred. The user might not have enough permissions.";
25
29
  readonly code: "DATABASE_PERMISSIONS_CHECK_FAILED";
@@ -1 +1 @@
1
- {"version":3,"file":"mosaic-errors.d.ts","sourceRoot":"","sources":["../../../src/common/errors/mosaic-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEf,CAAC"}
1
+ {"version":3,"file":"mosaic-errors.d.ts","sourceRoot":"","sources":["../../../src/common/errors/mosaic-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEf,CAAC"}
@@ -24,6 +24,10 @@ exports.MosaicErrors = {
24
24
  message: 'An expected and handled database constraint error has occurred. The actual message will have more information.',
25
25
  code: 'DATABASE_VALIDATION_FAILED',
26
26
  },
27
+ UniqueConstraintError: {
28
+ message: 'Attempt to create or update an element failed, as it would have resulted in a duplicate element.',
29
+ code: 'UNIQUE_CONSTRAINT_ERROR',
30
+ },
27
31
  // This code is used when an error is thrown by a row-level security permission check.
28
32
  DatabasePermissionsCheckFailed: {
29
33
  message: 'An authorization database error has occurred. The user might not have enough permissions.',
@@ -1 +1 @@
1
- {"version":3,"file":"mosaic-errors.js","sourceRoot":"","sources":["../../../src/common/errors/mosaic-errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,YAAY,GAAG;IAC1B,mBAAmB,EAAE;QACnB,OAAO,EACL,qFAAqF;QACvF,IAAI,EAAE,uBAAuB;KAC9B;IACD,sBAAsB,EAAE;QACtB,OAAO,EACL,uFAAuF;QACzF,IAAI,EAAE,0BAA0B;KACjC;IACD,cAAc,EAAE;QACd,OAAO,EACL,sEAAsE;QACxE,IAAI,EAAE,iBAAiB;KACxB;IACD,2GAA2G;IAC3G,wBAAwB,EAAE;QACxB,OAAO,EACL,gHAAgH;QAClH,IAAI,EAAE,4BAA4B;KACnC;IACD,sFAAsF;IACtF,8BAA8B,EAAE;QAC9B,OAAO,EACL,2FAA2F;QAC7F,IAAI,EAAE,mCAAmC;KAC1C;IACD,uBAAuB,EAAE;QACvB,OAAO,EACL,+HAA+H;QACjI,IAAI,EAAE,2BAA2B;KAClC;IACD,YAAY,EAAE;QACZ,OAAO,EACL,2FAA2F;QAC7F,IAAI,EAAE,eAAe;KACtB;IACD,eAAe,EAAE;QACf,OAAO,EAAE,mDAAmD;QAC5D,IAAI,EAAE,kBAAkB;KACzB;IACD,YAAY,EAAE;QACZ,OAAO,EACL,+EAA+E;QACjF,IAAI,EAAE,eAAe;KACtB;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,qBAAqB;KAC5B;IACD,yBAAyB,EAAE;QACzB,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,8BAA8B;KACrC;IACD,wBAAwB,EAAE;QACxB,OAAO,EAAE,4DAA4D;QACrE,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE;YACP,IAAI,EAAE,+MAA+M;SACtN;KACF;IACD,uBAAuB,EAAE;QACvB,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,2BAA2B;KAClC;CACO,CAAC"}
1
+ {"version":3,"file":"mosaic-errors.js","sourceRoot":"","sources":["../../../src/common/errors/mosaic-errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,YAAY,GAAG;IAC1B,mBAAmB,EAAE;QACnB,OAAO,EACL,qFAAqF;QACvF,IAAI,EAAE,uBAAuB;KAC9B;IACD,sBAAsB,EAAE;QACtB,OAAO,EACL,uFAAuF;QACzF,IAAI,EAAE,0BAA0B;KACjC;IACD,cAAc,EAAE;QACd,OAAO,EACL,sEAAsE;QACxE,IAAI,EAAE,iBAAiB;KACxB;IACD,2GAA2G;IAC3G,wBAAwB,EAAE;QACxB,OAAO,EACL,gHAAgH;QAClH,IAAI,EAAE,4BAA4B;KACnC;IACD,qBAAqB,EAAE;QACrB,OAAO,EACL,kGAAkG;QACpG,IAAI,EAAE,yBAAyB;KAChC;IACD,sFAAsF;IACtF,8BAA8B,EAAE;QAC9B,OAAO,EACL,2FAA2F;QAC7F,IAAI,EAAE,mCAAmC;KAC1C;IACD,uBAAuB,EAAE;QACvB,OAAO,EACL,+HAA+H;QACjI,IAAI,EAAE,2BAA2B;KAClC;IACD,YAAY,EAAE;QACZ,OAAO,EACL,2FAA2F;QAC7F,IAAI,EAAE,eAAe;KACtB;IACD,eAAe,EAAE;QACf,OAAO,EAAE,mDAAmD;QAC5D,IAAI,EAAE,kBAAkB;KACzB;IACD,YAAY,EAAE;QACZ,OAAO,EACL,+EAA+E;QACjF,IAAI,EAAE,eAAe;KACtB;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,qBAAqB;KAC5B;IACD,yBAAyB,EAAE;QACzB,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,8BAA8B;KACrC;IACD,wBAAwB,EAAE;QACxB,OAAO,EAAE,4DAA4D;QACrE,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE;YACP,IAAI,EAAE,+MAA+M;SACtN;KACF;IACD,uBAAuB,EAAE;QACvB,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,2BAA2B;KAClC;CACO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-service-common",
3
- "version": "0.53.0-rc.9",
3
+ "version": "0.53.0",
4
4
  "description": "Common helpers and PostgreSQL-related functionality",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "de01159b463c02e37f1ee997ccbc42a854873b1d"
72
+ "gitHead": "c0f92bb3b7f70813ad2dd1e36c2277a3372e1810"
73
73
  }
@@ -32,10 +32,9 @@ export const defaultPgErrorMapper: MosaicErrorMapper<MosaicErrorInfo> = (
32
32
  code: MosaicErrors.DatabaseValidationFailed.code,
33
33
  };
34
34
  case PgErrorCode.UniqueConstraintError:
35
- return {
36
- message: `Attempt to create or update an element failed, as it would have resulted in a duplicate element.`,
37
- code: MosaicErrors.DatabaseValidationFailed.code,
38
- };
35
+ // More specific mapping of constraint error to a readable message is
36
+ // expected to be done by individual services.
37
+ return MosaicErrors.UniqueConstraintError;
39
38
  case PgErrorCode.NotNullConstraintError:
40
39
  return {
41
40
  message: `The '${
@@ -25,6 +25,11 @@ export const MosaicErrors = {
25
25
  'An expected and handled database constraint error has occurred. The actual message will have more information.',
26
26
  code: 'DATABASE_VALIDATION_FAILED',
27
27
  },
28
+ UniqueConstraintError: {
29
+ message:
30
+ 'Attempt to create or update an element failed, as it would have resulted in a duplicate element.',
31
+ code: 'UNIQUE_CONSTRAINT_ERROR',
32
+ },
28
33
  // This code is used when an error is thrown by a row-level security permission check.
29
34
  DatabasePermissionsCheckFailed: {
30
35
  message: