@clipboard-health/util-ts 0.7.4 → 0.8.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.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.js +22 -9
- package/src/index.js.map +1 -1
- package/src/lib/cbh-error.d.ts +7 -2
- package/src/lib/cbh-error.d.ts.map +1 -1
- package/src/lib/cbh-error.js +1 -0
- package/src/lib/cbh-error.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.8.0](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.7.4...util-ts-0.8.0) (2023-08-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add API errors with helpers to create them from CbhError ([#252](https://github.com/ClipboardHealth/cbh-core/issues/252)) ([0efb42a](https://github.com/ClipboardHealth/cbh-core/commit/0efb42a9ef44831bf08b05a6ae19a55cfc38742a))
|
|
11
|
+
|
|
5
12
|
## [0.7.4](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.7.3...util-ts-0.7.4) (2023-07-12)
|
|
6
13
|
|
|
7
14
|
## [0.7.3](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.7.2...util-ts-0.7.3) (2023-07-10)
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
tslib_1.__exportStar(require("./lib/to-error"), exports);
|
|
17
|
+
__exportStar(require("./lib/cbh-error"), exports);
|
|
18
|
+
__exportStar(require("./lib/cbh-response"), exports);
|
|
19
|
+
__exportStar(require("./lib/defined-utils"), exports);
|
|
20
|
+
__exportStar(require("./lib/force-cast"), exports);
|
|
21
|
+
__exportStar(require("./lib/is-string"), exports);
|
|
22
|
+
__exportStar(require("./lib/non-empty-array"), exports);
|
|
23
|
+
__exportStar(require("./lib/stringify"), exports);
|
|
24
|
+
__exportStar(require("./lib/to-error"), exports);
|
|
12
25
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,qDAAmC;AACnC,sDAAoC;AACpC,mDAAiC;AACjC,kDAAgC;AAChC,wDAAsC;AACtC,kDAAgC;AAChC,iDAA+B"}
|
package/src/lib/cbh-error.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type OneOrNonEmptyArray } from "./non-empty-array";
|
|
2
|
+
declare const ERROR_STATUS_CODES: readonly [400, 401, 403, 404, 409, 429, 500];
|
|
3
|
+
export type ErrorStatusCode = (typeof ERROR_STATUS_CODES)[number];
|
|
2
4
|
export interface CbhIssue {
|
|
3
5
|
cause?: Error;
|
|
6
|
+
id?: string;
|
|
4
7
|
message: string;
|
|
8
|
+
statusCode?: ErrorStatusCode;
|
|
5
9
|
}
|
|
6
10
|
export declare class CbhError extends Error {
|
|
7
|
-
readonly issues:
|
|
11
|
+
readonly issues: CbhIssue[];
|
|
8
12
|
constructor(issues: OneOrNonEmptyArray<CbhIssue>);
|
|
9
13
|
}
|
|
14
|
+
export {};
|
|
10
15
|
//# sourceMappingURL=cbh-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"cbh-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAmB,MAAM,mBAAmB,CAAC;AAE7E,QAAA,MAAM,kBAAkB,8CAA+C,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,MAAM,EAAE,QAAQ,EAAE,CAAC;gBAEvB,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC;CAUjD"}
|
package/src/lib/cbh-error.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CbhError = void 0;
|
|
4
4
|
const non_empty_array_1 = require("./non-empty-array");
|
|
5
|
+
const ERROR_STATUS_CODES = [400, 401, 403, 404, 409, 429, 500];
|
|
5
6
|
class CbhError extends Error {
|
|
6
7
|
issues;
|
|
7
8
|
constructor(issues) {
|
package/src/lib/cbh-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"cbh-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":";;;AAAA,uDAA6E;AAE7E,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAUxE,MAAa,QAAS,SAAQ,KAAK;IACjB,MAAM,CAAa;IAEnC,YAAY,MAAoC;QAC9C,MAAM,EAAE,GAAG,IAAA,iCAAe,EAAC,MAAM,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/C,6FAA6F;QAC7F,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAbD,4BAaC"}
|