@final-hill/decorator-contracts 0.24.2 → 0.25.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.
Files changed (57) hide show
  1. package/README.md +28 -121
  2. package/dist/{AssertionError.d.ts → AssertionError.d.mts} +10 -10
  3. package/dist/Contract.d.mts +39 -0
  4. package/dist/Contracted.d.mts +21 -0
  5. package/dist/Messages.d.mts +16 -0
  6. package/dist/{assert.d.ts → assert.d.mts} +8 -8
  7. package/dist/{iff.d.ts → iff.d.mts} +7 -7
  8. package/dist/{implies.d.ts → implies.d.mts} +7 -7
  9. package/dist/index.d.mts +13 -0
  10. package/dist/index.mjs +3 -0
  11. package/dist/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +1 -1
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/lib/{ClassRegistration.d.ts → ClassRegistration.d.mts} +23 -24
  14. package/dist/lib/ClassType.d.mts +10 -0
  15. package/dist/lib/{Feature.d.ts → Feature.d.mts} +26 -29
  16. package/dist/lib/{assertDemands.d.ts → assertDemands.d.mts} +9 -9
  17. package/dist/lib/{assertEnsures.d.ts → assertEnsures.d.mts} +10 -10
  18. package/dist/lib/{assertInvariants.d.ts → assertInvariants.d.mts} +9 -9
  19. package/dist/lib/{CLASS_REGISTRY.d.ts → classRegistry.d.mts} +12 -12
  20. package/dist/lib/{deepFreeze.d.ts → deepFreeze.d.mts} +8 -8
  21. package/dist/lib/index.d.mts +18 -0
  22. package/dist/lib/{takeWhile.d.ts → takeWhile.d.mts} +8 -8
  23. package/dist/lib/{unChecked.d.ts → unChecked.d.mts} +9 -9
  24. package/dist/tests/{deepFreeze.test.d.ts → Contract.test.d.mts} +7 -7
  25. package/dist/tests/{Contract.test.d.ts → Stack.test.d.mts} +7 -7
  26. package/dist/tests/{assert.test.d.ts → assert.test.d.mts} +7 -7
  27. package/dist/tests/{Stack.test.d.ts → deepFreeze.test.d.mts} +7 -7
  28. package/dist/tests/demands.test.d.mts +7 -0
  29. package/dist/tests/ensures.test.d.mts +7 -0
  30. package/dist/tests/factoryPattern.test.d.mts +7 -0
  31. package/dist/tests/iff.test.d.mts +7 -0
  32. package/dist/tests/implies.test.d.mts +7 -0
  33. package/dist/tests/invariant.test.d.mts +7 -0
  34. package/dist/tests/public-properties.test.d.mts +7 -0
  35. package/dist/tests/rescue.test.d.mts +7 -0
  36. package/dist/tests/within.test.d.mts +7 -0
  37. package/package.json +25 -45
  38. package/CHANGELOG.md +0 -289
  39. package/dist/Contract.d.ts +0 -39
  40. package/dist/Contracted.d.ts +0 -12
  41. package/dist/Messages.d.ts +0 -18
  42. package/dist/index.d.ts +0 -14
  43. package/dist/index.js +0 -3
  44. package/dist/index.js.map +0 -1
  45. package/dist/lib/ClassType.d.ts +0 -10
  46. package/dist/lib/index.d.ts +0 -18
  47. package/dist/override.d.ts +0 -8
  48. package/dist/tests/demands.test.d.ts +0 -7
  49. package/dist/tests/ensures.test.d.ts +0 -7
  50. package/dist/tests/factoryPattern.test.d.ts +0 -7
  51. package/dist/tests/iff.test.d.ts +0 -7
  52. package/dist/tests/implies.test.d.ts +0 -7
  53. package/dist/tests/invariant.test.d.ts +0 -7
  54. package/dist/tests/override.test.d.ts +0 -7
  55. package/dist/tests/public-properties.test.d.ts +0 -7
  56. package/dist/tests/rescue.test.d.ts +0 -7
  57. package/dist/tests/within.test.d.ts +0 -7
@@ -1,29 +1,26 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import ClassRegistration from './ClassRegistration';
8
- declare class Feature {
9
- #private;
10
- readonly classRegistration: ClassRegistration;
11
- readonly name: PropertyKey;
12
- hasOverrides: boolean;
13
- constructor(classRegistration: ClassRegistration, name: PropertyKey, descriptor: PropertyDescriptor);
14
- get ancestorFeature(): Feature | null;
15
- get getter(): (() => any) | undefined;
16
- get hasGetter(): boolean;
17
- get hasSetter(): boolean;
18
- get isProperty(): boolean;
19
- get isMethod(): boolean;
20
- get isAccessor(): boolean;
21
- get memberType(): 'method' | 'property' | 'accessor';
22
- get setter(): ((v: any) => void) | undefined;
23
- get value(): any;
24
- get overriddenOriginalDescriptor(): PropertyDescriptor | undefined;
25
- set overriddenOriginalDescriptor(value: PropertyDescriptor | undefined);
26
- get descriptor(): PropertyDescriptor;
27
- set descriptor(desc: PropertyDescriptor);
28
- }
29
- export default Feature;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import ClassRegistration from './ClassRegistration.mjs';
8
+ declare class Feature {
9
+ #private;
10
+ readonly classRegistration: ClassRegistration;
11
+ readonly name: PropertyKey;
12
+ constructor(classRegistration: ClassRegistration, name: PropertyKey, descriptor: PropertyDescriptor);
13
+ get ancestorFeature(): Feature | null;
14
+ get getter(): (() => any) | undefined;
15
+ get hasGetter(): boolean;
16
+ get hasSetter(): boolean;
17
+ get isProperty(): boolean;
18
+ get isMethod(): boolean;
19
+ get isAccessor(): boolean;
20
+ get memberType(): 'method' | 'property' | 'accessor';
21
+ get setter(): ((v: any) => void) | undefined;
22
+ get value(): any;
23
+ get descriptor(): PropertyDescriptor;
24
+ set descriptor(desc: PropertyDescriptor);
25
+ }
26
+ export default Feature;
@@ -1,9 +1,9 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import { Contract } from '../';
8
- declare function assertDemands<U extends object>(ctx: U, contract: Contract<U>, className: string, featureName: PropertyKey, args: any[]): void;
9
- export default assertDemands;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import { Contract } from '../index.mjs';
8
+ declare function assertDemands<U extends object>(ctx: U, contract: Contract<U>, className: string, featureName: PropertyKey, args: any[]): void;
9
+ export default assertDemands;
@@ -1,10 +1,10 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import { Properties } from '../Contract';
8
- import { Contract } from '../';
9
- declare function assertEnsures<U extends Properties<any>>(ctx: U, contract: Contract<any>, className: string, featureName: PropertyKey, old: U, args: any[]): void;
10
- export default assertEnsures;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import { Properties } from '../Contract.mjs';
8
+ import { Contract } from '../index.mjs';
9
+ declare function assertEnsures<U extends Properties<any>>(ctx: U, contract: Contract<any>, className: string, featureName: PropertyKey, old: U, args: any[]): void;
10
+ export default assertEnsures;
@@ -1,9 +1,9 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import { Contract } from '../';
8
- declare function assertInvariants<U>(ctx: U, contract: Contract<any>): void;
9
- export default assertInvariants;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import { Contract } from '../index.mjs';
8
+ declare function assertInvariants<U>(ctx: U, contract: Contract<any>): void;
9
+ export default assertInvariants;
@@ -1,12 +1,12 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import { ClassRegistration, ClassType } from './';
8
- declare class ClassRegistry extends WeakMap<ClassType<any>, ClassRegistration> {
9
- getOrCreate(Class: ClassType<any>): ClassRegistration;
10
- }
11
- declare const CLASS_REGISTRY: ClassRegistry;
12
- export default CLASS_REGISTRY;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import { ClassRegistration, ClassType } from './index.mjs';
8
+ declare class ClassRegistry extends WeakMap<ClassType<any>, ClassRegistration> {
9
+ getOrCreate(Class: ClassType<any>): ClassRegistration;
10
+ }
11
+ declare const _default: ClassRegistry;
12
+ export default _default;
@@ -1,8 +1,8 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- declare function deepFreeze(object: Record<PropertyKey, any>): void;
8
- export default deepFreeze;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ declare function deepFreeze(object: Record<PropertyKey, any>): void;
8
+ export default deepFreeze;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import assertDemands from './assertDemands.mjs';
8
+ import assertEnsures from './assertEnsures.mjs';
9
+ import assertInvariants from './assertInvariants.mjs';
10
+ import classRegistry from './classRegistry.mjs';
11
+ import ClassRegistration from './ClassRegistration.mjs';
12
+ import { ClassType } from './ClassType.mjs';
13
+ import deepFreeze from './deepFreeze.mjs';
14
+ import Feature from './Feature.mjs';
15
+ import takeWhile from './takeWhile.mjs';
16
+ import unChecked from './unChecked.mjs';
17
+ declare const fnTrue: () => boolean;
18
+ export { assertDemands, assertEnsures, assertInvariants, classRegistry, ClassRegistration, ClassType, deepFreeze, Feature, fnTrue, takeWhile, unChecked };
@@ -1,8 +1,8 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- export declare function takeWhile<T>(xs: T[], pred: (x: T) => boolean): T[];
8
- export default takeWhile;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export declare function takeWhile<T>(xs: T[], pred: (x: T) => boolean): T[];
8
+ export default takeWhile;
@@ -1,9 +1,9 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- import { Contract } from '../';
8
- declare const unChecked: (contract: Contract<any>, fn: () => any) => void;
9
- export default unChecked;
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ import { Contract } from '../index.mjs';
8
+ declare const unChecked: (contract: Contract<any>, fn: () => any) => void;
9
+ export default unChecked;
@@ -1,7 +1,7 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- export {};
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -1,7 +1,7 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- export {};
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -1,7 +1,7 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- export {};
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -1,7 +1,7 @@
1
- /*!
2
- * @license
3
- * Copyright (C) 2022 Final Hill LLC
4
- * SPDX-License-Identifier: AGPL-3.0-only
5
- * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
- */
7
- export {};
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @license
3
+ * Copyright (C) 2024 Final Hill LLC
4
+ * SPDX-License-Identifier: AGPL-3.0-only
5
+ * @see <https://spdx.org/licenses/AGPL-3.0-only.html>
6
+ */
7
+ export {};
package/package.json CHANGED
@@ -1,23 +1,19 @@
1
1
  {
2
2
  "name": "@final-hill/decorator-contracts",
3
- "version": "0.24.2",
3
+ "version": "0.25.1",
4
4
  "description": "Code Contracts for TypeScript and ECMAScript classes",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.mjs"
10
+ }
11
+ },
7
12
  "scripts": {
8
- "prebuild": "npm run clean && npm run lint",
13
+ "prebuild": "npm run lint",
9
14
  "build": "webpack",
10
- "prebuild-nofix": "npm run clean && npm run lint-nofix",
11
- "build-nofix": "webpack",
12
- "clean": "rimraf ./dist ./coverage",
13
- "clean-full": "rimraf ./dist, ./coverage, ./.cache, ./node_modules",
14
- "debug": "node --inspect-brk --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage",
15
- "prelint": "npm run type-check",
16
- "lint": "eslint src/ --ext .ts --fix",
17
- "prelint-nofix": "npm run type-check",
18
- "lint-nofix": "eslint src/ --ext .ts",
19
- "test": "jest --coverage",
20
- "type-check": "tsc -p tsconfig.json --noEmit"
15
+ "lint": "eslint src/ --ext .mts --fix",
16
+ "test": "jest --coverage"
21
17
  },
22
18
  "repository": {
23
19
  "type": "git",
@@ -26,21 +22,6 @@
26
22
  "bugs": {
27
23
  "url": "https://github.com/final-hill/decorator-contracts/issues"
28
24
  },
29
- "jest": {
30
- "reporters": [
31
- "default",
32
- [
33
- "jest-junit",
34
- {
35
- "outputDirectory": "./coverage"
36
- }
37
- ]
38
- ],
39
- "testEnvironment": "node",
40
- "transform": {
41
- "^.+\\.ts$": "ts-jest"
42
- }
43
- },
44
25
  "keywords": [
45
26
  "assertion",
46
27
  "biconditional",
@@ -57,7 +38,6 @@
57
38
  "LSP",
58
39
  "material-implication",
59
40
  "organized-panic",
60
- "overrides",
61
41
  "precondition",
62
42
  "postcondition",
63
43
  "rescue",
@@ -67,21 +47,21 @@
67
47
  "author": "Michael L Haufe <michael.haufe@final-hill.com> (https://final-hill.com)",
68
48
  "license": "AGPL-3.0-only",
69
49
  "devDependencies": {
70
- "@types/jest": "^28.1.6",
71
- "@types/node": "^18.7.1",
72
- "@typescript-eslint/eslint-plugin": "^5.33.0",
73
- "@typescript-eslint/parser": "^5.33.0",
74
- "eslint": "^8.21.0",
50
+ "@types/jest": "^29.5.11",
51
+ "@types/node": "^20.11.2",
52
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
53
+ "@typescript-eslint/parser": "^6.19.0",
54
+ "eslint": "^8.56.0",
75
55
  "eslint-plugin-header": "^3.1.1",
76
- "eslint-plugin-import": "^2.26.0",
77
- "jest": "^28.1.3",
78
- "jest-junit": "^14.0.0",
79
- "rimraf": "^3.0.2",
80
- "ts-jest": "^28.0.7",
81
- "ts-loader": "^9.3.1",
82
- "typescript": "^4.7.4",
83
- "webpack": "^5.74.0",
84
- "webpack-cli": "^4.10.0"
56
+ "eslint-plugin-import": "^2.29.1",
57
+ "eslint-webpack-plugin": "^4.0.1",
58
+ "jest": "^29.7.0",
59
+ "jest-junit": "^16.0.0",
60
+ "ts-jest": "^29.1.1",
61
+ "ts-loader": "^9.5.1",
62
+ "typescript": "^5.3.3",
63
+ "webpack": "^5.89.0",
64
+ "webpack-cli": "^5.1.4"
85
65
  },
86
66
  "files": [
87
67
  "dist"