@speclynx/apidom-error 1.12.1

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.
@@ -0,0 +1,26 @@
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are
3
+ met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright
6
+ notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ 3. Neither the name of the copyright holder nor the names of its
13
+ contributors may be used to endorse or promote products derived from
14
+ this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,65 @@
1
+ Additional Notices for SpecLynx Distribution
2
+ Copyright 2025 SpecLynx
3
+ This distribution is known as "SpecLynx ApiDOM". It is a fork of the ApiDOM project maintained by SmartBear.
4
+ This distribution includes modifications by SpecLynx.
5
+ All such modifications are licensed under the Apache License, Version 2.0.
6
+ A copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt`.
7
+
8
+ ApiDOM
9
+ Copyright 2020 SmartBear Software Inc.
10
+ ApiDOM is licensed under Apache 2.0 license.
11
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
12
+
13
+ json-schema-ref-parser
14
+ Copyright (c) 2015 James Messinger
15
+ File packages/apidom-reference/src/util/url.ts (the file) was originally created under MIT license in https://github.com/APIDevTools/json-schema-ref-parser repository.
16
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
17
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
18
+
19
+ graphql-js
20
+ Copyright (c) GraphQL Contributors
21
+ File packages/apidom-ast/src/traversal/visitor.ts (the file) was originally created under MIT license in https://github.com/graphql/graphql-js repository.
22
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
23
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
24
+
25
+ babel-plugin-add-import-extension
26
+ Copyright (c) 2019 Karl Prieb
27
+ File scripts/babel-plugin-add-import-extension.cjs (the file) was originally created under MIT license in https://codeberg.org/karl/babel-plugin-add-import-extension.
28
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
29
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
30
+
31
+ refract-spec
32
+ Copyright (c) 2015 refractproject
33
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
34
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
35
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
36
+
37
+ api-elements
38
+ Copyright (c) 2015 Apiary Inc.
39
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
40
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
41
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
42
+
43
+ deepmerge
44
+ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
45
+ - File packages/apidom-core/src/deepmerge.ts contains algorithms that we originally created
46
+ in https://github.com/TehShrike/deepmerge/blob/master/index.js to handle deep merging of JavaScript Objects and Arrays.
47
+ These algorithms have been reverse engineered and adapted to support deep merging of ApiDOM structures.
48
+ - File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that were originally created
49
+ in https://github.com/TehShrike/deepmerge/blob/master/test/merge.js to test deep merging of JavaScript Objects and Arrays.
50
+ These tests have been adapted to support testing deep merging of ApiDOM structures.
51
+ - File packages/apidom-core/README.md contains text fragments that were originally created
52
+ in https://github.com/TehShrike/deepmerge/blob/master/readme.md to document deepmerge library.
53
+ These text fragments have been amended to describe merging of ApiDOM structures.
54
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
55
+ All modifications are licensed under Apache 2.0 License.
56
+
57
+ ---
58
+
59
+ If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
60
+ it is assumed that these tags have following implicit value:
61
+
62
+ SPDX-FileCopyrightText: Copyright 2025 SpecLynx
63
+ SPDX-FileCopyrightText: Copyright 2020-2021 SmartBear Software Inc.
64
+ SPDX-License-Identifier: Apache-2.0
65
+
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # @speclynx/apidom-error
2
+
3
+ `apidom-error` provides several error classes in support of [Joyent's Best Practices for Error Handling in Node.js](http://web.archive.org/web/20150221074228/http://www.joyent.com/developers/node/design/errors).
4
+ These error classes should be used as a superclass for all **operational errors**.
5
+ Operational errors represent run-time problems experienced by correctly-written programs.
6
+
7
+ Error classes from `apidom-error` handle complexities of extending native Error class
8
+ and support [error chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause)
9
+ in backward and forward compatible way.
10
+
11
+ ## Base errors
12
+
13
+ Base errors are meant to directly be thrown by ApiDOM code or to be extended
14
+ to form custom error hierarchies.
15
+
16
+ ### ApiDOMError
17
+
18
+ Basic error class that can be easily extended and form error chains.
19
+
20
+ ```js
21
+ import { ApiDOMError } from '@speclynx/apidom-error';
22
+
23
+ const error1 = new ApiDOMError('error message'); // basic error
24
+ const error2 = new ApiDOMError('error message', { cause: new Error('cause') }); // error chain
25
+ ```
26
+
27
+ ### ApiDOMStructuredError
28
+
29
+ Error class that is based on `ApiDOMError` and allows to assign arbitrary data properties to its instances.
30
+
31
+ ```js
32
+ import { ApiDOMStructuredError } from '@speclynx/apidom-error';
33
+
34
+ const error1 = new ApiDOMStructuredError('error message', { cause: new Error('cause') }); // just like ApiDOMError
35
+
36
+ const error2 = new ApiDOMStructuredError('error message', {
37
+ prop1: 'value1',
38
+ prop2: 3,
39
+ })
40
+ error2.prop1; // => 'value1'
41
+ error2.prop2; // => 3
42
+ ```
43
+
44
+ Although structured error class gives convenience by assigning arbitrary properties,
45
+ it's highly recommended to extend `ApiDOMStructuredError` class and create public properties
46
+ explicitly.
47
+
48
+ ```typescript
49
+ import { ApiDOMStructuredError, ApiDOMErrorOptions } from '@speclynx/apidom-error';
50
+
51
+ interface StructuredErrorOptions extends ApiDOMErrorOptions {
52
+ readonly prop1: string;
53
+ readonly prop2: number;
54
+ }
55
+
56
+ class PropError extends ApiDOMStructuredError {
57
+ public readonly prop1: string;
58
+ public readonly prop2: number;
59
+
60
+ constructor(message?: string, options?: StructuredErrorOptions) {
61
+ super(message, options)
62
+ if (typeof options !== 'undefined') {
63
+ this.prop1 = options.prop1;
64
+ this.prop2 = options.prop2;
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ ### ApiDOMAggregateError
71
+
72
+ `ApiDOMAggregateError` can be easily extended and represents instance of an error when
73
+ several errors need to be wrapped in a single error. It is thrown when multiple errors
74
+ need to be reported by an operation. Supports error chaining as well.
75
+
76
+ ```js
77
+ import { ApiDOMAggregateError } from '@speclynx/apidom-error';
78
+
79
+ const error1 = new Error('error1');
80
+ const error2 = new Error('error2');
81
+ const cause = new Error('optional cause');
82
+
83
+ const aggregateError = new ApiDOMAggregateError([error1, error2], 'aggregate error', {
84
+ cause,
85
+ });
86
+ ```
87
+
88
+ This class is based on native [AggregateError], and due to the fact that JavaScript
89
+ classes don't support multiple inheritance, it cannot also be based on `ApiDOMError`.
90
+ Nevertheless, for convenience, following will work:
91
+
92
+ ```js
93
+ import { ApiDOMAggregateError, ApiDOMError } from '@speclynx/apidom-error';
94
+
95
+ const aggregateError = new ApiDOMAggregateError([]);
96
+ aggregateError instanceof ApiDOMError; // => true
97
+ aggregateError instanceof AggregateError; // => true
98
+ ```
99
+
100
+ ## Generic custom errors
101
+
102
+ Generic custom errors represent custom errors that are generic enough
103
+ to be used across ApiDOM monorepo packages and are not specific to any
104
+ particular ApiDOM package.
105
+
106
+ ### UnsupportedOperationError
107
+
108
+ This error class that is based on `ApiDOMError`. Thrown to indicate that the requested operation is not supported.
109
+
110
+ ```js
111
+ import { UnsupportedOperationError } from '@speclynx/apidom-error';
112
+
113
+ const error = new UnsupportedOperationError('error message');
114
+ ```
115
+
116
+ ### NotImplementedError
117
+
118
+ Error class that is based on `UnsupportedOperationError` and. It is thrown to indicate that a block
119
+ of code has not been implemented. This exception provides a more semantically rich description
120
+ of the problem than base `ApiDOMError`.
121
+
122
+ ```js
123
+ import { NotImplementedError } from '@speclynx/apidom-error';
124
+
125
+ const error = new NotImplementedError('error message');
126
+ ```
127
+
128
+
@@ -0,0 +1,212 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["apidomError"] = factory();
8
+ else
9
+ root["apidomError"] = factory();
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 172:
16
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17
+
18
+ __webpack_require__.r(__webpack_exports__);
19
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
21
+ /* harmony export */ });
22
+ /**
23
+ * @public
24
+ */
25
+ class ApiDOMAggregateError extends AggregateError {
26
+ constructor(errors, message, options) {
27
+ super(errors, message, options);
28
+ this.name = this.constructor.name;
29
+ if (typeof Error.captureStackTrace === 'function') {
30
+ Error.captureStackTrace(this, this.constructor);
31
+ }
32
+ }
33
+ }
34
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ApiDOMAggregateError);
35
+
36
+ /***/ }),
37
+
38
+ /***/ 428:
39
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
40
+
41
+ __webpack_require__.r(__webpack_exports__);
42
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
43
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
44
+ /* harmony export */ });
45
+ /* harmony import */ var _UnsupportedOperationError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(537);
46
+
47
+
48
+ /**
49
+ * @public
50
+ */
51
+ class NotImplementedError extends _UnsupportedOperationError_ts__WEBPACK_IMPORTED_MODULE_0__["default"] {}
52
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NotImplementedError);
53
+
54
+ /***/ }),
55
+
56
+ /***/ 537:
57
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
58
+
59
+ __webpack_require__.r(__webpack_exports__);
60
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
61
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
62
+ /* harmony export */ });
63
+ /* harmony import */ var _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(797);
64
+
65
+
66
+ /**
67
+ * @public
68
+ */
69
+ class UnsupportedOperationError extends _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__["default"] {}
70
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UnsupportedOperationError);
71
+
72
+ /***/ }),
73
+
74
+ /***/ 672:
75
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
76
+
77
+ __webpack_require__.r(__webpack_exports__);
78
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
80
+ /* harmony export */ });
81
+ /* harmony import */ var _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(797);
82
+
83
+ /**
84
+ * @public
85
+ */
86
+ class ApiDOMStructuredError extends _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__["default"] {
87
+ constructor(message, structuredOptions) {
88
+ super(message, structuredOptions);
89
+ if (structuredOptions != null && typeof structuredOptions === 'object') {
90
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
+ const {
92
+ cause,
93
+ ...causelessOptions
94
+ } = structuredOptions;
95
+ Object.assign(this, causelessOptions);
96
+ }
97
+ }
98
+ }
99
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ApiDOMStructuredError);
100
+
101
+ /***/ }),
102
+
103
+ /***/ 797:
104
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
105
+
106
+ __webpack_require__.r(__webpack_exports__);
107
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
108
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
109
+ /* harmony export */ });
110
+ /* harmony import */ var _ApiDOMAggregateError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(172);
111
+
112
+ /**
113
+ * @public
114
+ */
115
+ class ApiDOMError extends Error {
116
+ static [Symbol.hasInstance](instance) {
117
+ // we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass
118
+ return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(_ApiDOMAggregateError_ts__WEBPACK_IMPORTED_MODULE_0__["default"], instance);
119
+ }
120
+ constructor(message, options) {
121
+ super(message, options);
122
+ this.name = this.constructor.name;
123
+ if (typeof Error.captureStackTrace === 'function') {
124
+ Error.captureStackTrace(this, this.constructor);
125
+ }
126
+ }
127
+ }
128
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ApiDOMError);
129
+
130
+ /***/ })
131
+
132
+ /******/ });
133
+ /************************************************************************/
134
+ /******/ // The module cache
135
+ /******/ var __webpack_module_cache__ = {};
136
+ /******/
137
+ /******/ // The require function
138
+ /******/ function __webpack_require__(moduleId) {
139
+ /******/ // Check if module is in cache
140
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
141
+ /******/ if (cachedModule !== undefined) {
142
+ /******/ return cachedModule.exports;
143
+ /******/ }
144
+ /******/ // Create a new module (and put it into the cache)
145
+ /******/ var module = __webpack_module_cache__[moduleId] = {
146
+ /******/ // no module.id needed
147
+ /******/ // no module.loaded needed
148
+ /******/ exports: {}
149
+ /******/ };
150
+ /******/
151
+ /******/ // Execute the module function
152
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
153
+ /******/
154
+ /******/ // Return the exports of the module
155
+ /******/ return module.exports;
156
+ /******/ }
157
+ /******/
158
+ /************************************************************************/
159
+ /******/ /* webpack/runtime/define property getters */
160
+ /******/ (() => {
161
+ /******/ // define getter functions for harmony exports
162
+ /******/ __webpack_require__.d = (exports, definition) => {
163
+ /******/ for(var key in definition) {
164
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
165
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
166
+ /******/ }
167
+ /******/ }
168
+ /******/ };
169
+ /******/ })();
170
+ /******/
171
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
172
+ /******/ (() => {
173
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
174
+ /******/ })();
175
+ /******/
176
+ /******/ /* webpack/runtime/make namespace object */
177
+ /******/ (() => {
178
+ /******/ // define __esModule on exports
179
+ /******/ __webpack_require__.r = (exports) => {
180
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
181
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
182
+ /******/ }
183
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
184
+ /******/ };
185
+ /******/ })();
186
+ /******/
187
+ /************************************************************************/
188
+ var __webpack_exports__ = {};
189
+ __webpack_require__.r(__webpack_exports__);
190
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
191
+ /* harmony export */ ApiDOMAggregateError: () => (/* reexport safe */ _ApiDOMAggregateError_ts__WEBPACK_IMPORTED_MODULE_1__["default"]),
192
+ /* harmony export */ ApiDOMError: () => (/* reexport safe */ _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__["default"]),
193
+ /* harmony export */ ApiDOMStructuredError: () => (/* reexport safe */ _ApiDOMStructuredError_ts__WEBPACK_IMPORTED_MODULE_2__["default"]),
194
+ /* harmony export */ NotImplementedError: () => (/* reexport safe */ _NotImplementedError_ts__WEBPACK_IMPORTED_MODULE_4__["default"]),
195
+ /* harmony export */ UnsupportedOperationError: () => (/* reexport safe */ _UnsupportedOperationError_ts__WEBPACK_IMPORTED_MODULE_3__["default"])
196
+ /* harmony export */ });
197
+ /* harmony import */ var _ApiDOMError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(797);
198
+ /* harmony import */ var _ApiDOMAggregateError_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(172);
199
+ /* harmony import */ var _ApiDOMStructuredError_ts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(672);
200
+ /* harmony import */ var _UnsupportedOperationError_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(537);
201
+ /* harmony import */ var _NotImplementedError_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(428);
202
+ // base error classes
203
+
204
+
205
+
206
+ // generic custom error classes
207
+
208
+
209
+ /******/ return __webpack_exports__;
210
+ /******/ })()
211
+ ;
212
+ });
@@ -0,0 +1 @@
1
+ !function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomError=t():r.apidomError=t()}(self,()=>(()=>{"use strict";var r={d:(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};r.r(t),r.d(t,{ApiDOMAggregateError:()=>o,ApiDOMError:()=>c,ApiDOMStructuredError:()=>n,NotImplementedError:()=>p,UnsupportedOperationError:()=>a});class e extends AggregateError{constructor(r,t,e){super(r,t,e),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const o=e;class s extends Error{static[Symbol.hasInstance](r){return super[Symbol.hasInstance](r)||Function.prototype[Symbol.hasInstance].call(o,r)}constructor(r,t){super(r,t),this.name=this.constructor.name,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}const c=s;const n=class extends c{constructor(r,t){if(super(r,t),null!=t&&"object"==typeof t){const{cause:r,...e}=t;Object.assign(this,e)}}};const a=class extends c{};const p=class extends a{};return t})());
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@speclynx/apidom-error",
3
+ "version": "1.12.1",
4
+ "description": "Backward compatible custom ApiDOM errors with causes.",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org",
8
+ "provenance": true
9
+ },
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "unpkg": "./dist/apidom-error.browser.min.js",
13
+ "main": "./src/index.cjs",
14
+ "exports": {
15
+ "types": "./types/apidom-error.d.ts",
16
+ "import": "./src/index.mjs",
17
+ "require": "./src/index.cjs"
18
+ },
19
+ "types": "./types/apidom-error.d.ts",
20
+ "scripts": {
21
+ "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
22
+ "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
23
+ "build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
24
+ "build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
25
+ "lint": "eslint ./",
26
+ "lint:fix": "eslint ./ --fix",
27
+ "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
28
+ "typescript:check-types": "tsc --noEmit",
29
+ "typescript:declaration": "copyfiles -u 1 'src/**/*.d.ts' ./types && tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
30
+ "test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
31
+ "prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
32
+ "postpack": "rimraf NOTICE LICENSES"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/speclynx/apidom.git"
37
+ },
38
+ "author": "Vladimír Gorej <vladimir.gorej@gmail.com>",
39
+ "license": "Apache-2.0",
40
+ "dependencies": {
41
+ "@babel/runtime-corejs3": "^7.28.4"
42
+ },
43
+ "files": [
44
+ "src/**/*.mjs",
45
+ "src/**/*.cjs",
46
+ "dist/",
47
+ "types/apidom-error.d.ts",
48
+ "LICENSES",
49
+ "NOTICE",
50
+ "README.md",
51
+ "CHANGELOG.md"
52
+ ],
53
+ "gitHead": "49be88493f922c4ace2e4ebc0f23387ccb62c4fc"
54
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ /**
6
+ * @public
7
+ */
8
+ class ApiDOMAggregateError extends AggregateError {
9
+ constructor(errors, message, options) {
10
+ super(errors, message, options);
11
+ this.name = this.constructor.name;
12
+ if (typeof Error.captureStackTrace === 'function') {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ }
16
+ }
17
+ var _default = exports.default = ApiDOMAggregateError;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @public
3
+ */
4
+ class ApiDOMAggregateError extends AggregateError {
5
+ constructor(errors, message, options) {
6
+ super(errors, message, options);
7
+ this.name = this.constructor.name;
8
+ if (typeof Error.captureStackTrace === 'function') {
9
+ Error.captureStackTrace(this, this.constructor);
10
+ }
11
+ }
12
+ }
13
+ export default ApiDOMAggregateError;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _ApiDOMAggregateError = _interopRequireDefault(require("./ApiDOMAggregateError.cjs"));
7
+ /**
8
+ * @public
9
+ */
10
+ class ApiDOMError extends Error {
11
+ static [Symbol.hasInstance](instance) {
12
+ // we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass
13
+ return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(_ApiDOMAggregateError.default, instance);
14
+ }
15
+ constructor(message, options) {
16
+ super(message, options);
17
+ this.name = this.constructor.name;
18
+ if (typeof Error.captureStackTrace === 'function') {
19
+ Error.captureStackTrace(this, this.constructor);
20
+ }
21
+ }
22
+ }
23
+ var _default = exports.default = ApiDOMError;
@@ -0,0 +1,18 @@
1
+ import ApiDOMAggregateError from "./ApiDOMAggregateError.mjs";
2
+ /**
3
+ * @public
4
+ */
5
+ class ApiDOMError extends Error {
6
+ static [Symbol.hasInstance](instance) {
7
+ // we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass
8
+ return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(ApiDOMAggregateError, instance);
9
+ }
10
+ constructor(message, options) {
11
+ super(message, options);
12
+ this.name = this.constructor.name;
13
+ if (typeof Error.captureStackTrace === 'function') {
14
+ Error.captureStackTrace(this, this.constructor);
15
+ }
16
+ }
17
+ }
18
+ export default ApiDOMError;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _ApiDOMError = _interopRequireDefault(require("./ApiDOMError.cjs"));
7
+ /**
8
+ * @public
9
+ */
10
+ class ApiDOMStructuredError extends _ApiDOMError.default {
11
+ constructor(message, structuredOptions) {
12
+ super(message, structuredOptions);
13
+ if (structuredOptions != null && typeof structuredOptions === 'object') {
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ const {
16
+ cause,
17
+ ...causelessOptions
18
+ } = structuredOptions;
19
+ Object.assign(this, causelessOptions);
20
+ }
21
+ }
22
+ }
23
+ var _default = exports.default = ApiDOMStructuredError;
@@ -0,0 +1,18 @@
1
+ import ApiDOMError from "./ApiDOMError.mjs";
2
+ /**
3
+ * @public
4
+ */
5
+ class ApiDOMStructuredError extends ApiDOMError {
6
+ constructor(message, structuredOptions) {
7
+ super(message, structuredOptions);
8
+ if (structuredOptions != null && typeof structuredOptions === 'object') {
9
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
+ const {
11
+ cause,
12
+ ...causelessOptions
13
+ } = structuredOptions;
14
+ Object.assign(this, causelessOptions);
15
+ }
16
+ }
17
+ }
18
+ export default ApiDOMStructuredError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _UnsupportedOperationError = _interopRequireDefault(require("./UnsupportedOperationError.cjs"));
7
+ /**
8
+ * @public
9
+ */
10
+ class NotImplementedError extends _UnsupportedOperationError.default {}
11
+ var _default = exports.default = NotImplementedError;
@@ -0,0 +1,6 @@
1
+ import UnsupportedOperationError from "./UnsupportedOperationError.mjs";
2
+ /**
3
+ * @public
4
+ */
5
+ class NotImplementedError extends UnsupportedOperationError {}
6
+ export default NotImplementedError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _ApiDOMError = _interopRequireDefault(require("./ApiDOMError.cjs"));
7
+ /**
8
+ * @public
9
+ */
10
+ class UnsupportedOperationError extends _ApiDOMError.default {}
11
+ var _default = exports.default = UnsupportedOperationError;
@@ -0,0 +1,6 @@
1
+ import ApiDOMError from "./ApiDOMError.mjs";
2
+ /**
3
+ * @public
4
+ */
5
+ class UnsupportedOperationError extends ApiDOMError {}
6
+ export default UnsupportedOperationError;