@singularsystems/neo-core 1.3.3 → 1.3.4

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 CHANGED
@@ -1,15 +1,8 @@
1
+ # Neo core changelog
1
2
 
3
+ ## Version 1.3.4 (15 Oct 2025)
2
4
 
3
- # Breaking changes
4
-
5
- ## 0.10.65 (6 March 2023)
6
-
7
- * `IErrorHandler` now requires the return type to be `Promise<IErrorDisplay>` instead of `IErrorDisplay`.
8
- * Most of the protected methods in `ErrorHandler` have been changed to `async`.
9
- * These changes were required in order to be able to read errors from axios blob responses.
10
-
11
- # Change Log
12
-
13
- ## 0.10.65 (6 March 2023)
14
-
15
- * Fixed error handler not parsing axios responses when response type is `blob`.
5
+ - JsonSchema
6
+ - Property info - added a reference to the property's parent class.
7
+ - ModelBase
8
+ - Added `getBrokenRulesGraph` method to the model validator. This can be used instead of the separate `Validation.getValidationSummary` helper method.
@@ -1,7 +1,7 @@
1
1
  import { PropertyMetadata } from './PropertyMetadata';
2
2
  import { IJsonObjectType } from './JsonSchemaTypes';
3
- import { ITypeCacheInternal } from './TypeCache';
4
3
  import { MetadataBase } from './MetadataBase';
4
+ import { TypeCache } from "./TypeCache";
5
5
  export declare class ClassMetadata extends MetadataBase {
6
6
  name: string;
7
7
  constructor(name: string);
@@ -21,6 +21,6 @@ export declare class ClassMetadata extends MetadataBase {
21
21
  * Properties containing child list types.
22
22
  */
23
23
  childListProperties: PropertyMetadata[];
24
- loadMetaData(schema: IJsonObjectType, cache: ITypeCacheInternal): void;
24
+ loadMetaData(schema: IJsonObjectType, cache: TypeCache): void;
25
25
  clone(): ClassMetadata;
26
26
  }
@@ -29,7 +29,7 @@ var ClassMetadata = /** @class */ (function (_super) {
29
29
  _super.prototype.loadFromSchema.call(this, schema);
30
30
  for (var propertyKey in schema.properties) {
31
31
  var propertySchema = schema.properties[propertyKey];
32
- var propertyMetaData = new PropertyMetadata(propertyKey, TypeMetadata.create(propertySchema, cache));
32
+ var propertyMetaData = new PropertyMetadata(propertyKey, TypeMetadata.create(propertySchema, cache), this);
33
33
  propertyMetaData.loadFromSchema(propertySchema);
34
34
  if (propertyMetaData.type.basicType !== "unknown") {
35
35
  this.properties.push(propertyMetaData);
@@ -1,10 +1,12 @@
1
+ import { ClassMetadata } from "./ClassMetadata";
1
2
  import { IJsonSchemaDescriptorType } from './JsonSchemaTypes';
2
3
  import { MetadataBase } from './MetadataBase';
3
4
  import { TypeMetadata } from './TypeMetadata';
4
5
  export declare class PropertyMetadata extends MetadataBase {
5
6
  propertyName: string;
6
7
  type: TypeMetadata;
7
- constructor(propertyName: string, type: TypeMetadata);
8
+ classType: ClassMetadata;
9
+ constructor(propertyName: string, type: TypeMetadata, classType: ClassMetadata);
8
10
  formatString?: string;
9
11
  width?: number;
10
12
  hAlign?: "left" | "center" | "right";
@@ -2,10 +2,11 @@ import { __extends } from "tslib";
2
2
  import { MetadataBase } from './MetadataBase';
3
3
  var PropertyMetadata = /** @class */ (function (_super) {
4
4
  __extends(PropertyMetadata, _super);
5
- function PropertyMetadata(propertyName, type) {
5
+ function PropertyMetadata(propertyName, type, classType) {
6
6
  var _this = _super.call(this) || this;
7
7
  _this.propertyName = propertyName;
8
8
  _this.type = type;
9
+ _this.classType = classType;
9
10
  return _this;
10
11
  }
11
12
  PropertyMetadata.prototype.loadFromSchema = function (schema) {
@@ -1,8 +1,5 @@
1
1
  import { TypeMetadata } from './TypeMetadata';
2
2
  import { RootType } from './JsonSchemaTypes';
3
- export interface ITypeCacheInternal {
4
- getOrAddType(name: string): TypeMetadata;
5
- }
6
3
  export declare class TypeCache {
7
4
  private schema;
8
5
  private _objects;
@@ -12,5 +9,6 @@ export declare class TypeCache {
12
9
  get objects(): {
13
10
  [index: string]: TypeMetadata;
14
11
  };
15
- private getOrAddType;
12
+ /** @internal */
13
+ getOrAddType(name: string): TypeMetadata;
16
14
  }
@@ -20,7 +20,7 @@ var TypeCache = /** @class */ (function () {
20
20
  enumerable: false,
21
21
  configurable: true
22
22
  });
23
- // This is an internal method used by TypeMetadata
23
+ /** @internal */
24
24
  TypeCache.prototype.getOrAddType = function (name) {
25
25
  if (name.startsWith("#/definitions/")) {
26
26
  name = name.replace("#/definitions/", "");
@@ -1,6 +1,6 @@
1
1
  import { BasicType, IJsonSimpleType, IJsonArrayType, IJsonReferenceType, RootType } from './JsonSchemaTypes';
2
- import { ITypeCacheInternal } from './TypeCache';
3
2
  import { ClassMetadata } from './ClassMetadata';
3
+ import { TypeCache } from '.';
4
4
  export declare class TypeMetadata {
5
5
  basicType: BasicType;
6
6
  /**
@@ -26,8 +26,8 @@ export declare class TypeMetadata {
26
26
  * @param cache Type cache instance.
27
27
  */
28
28
  static create(schema: RootType): TypeMetadata;
29
- static create(schema: IJsonSimpleType | IJsonReferenceType | IJsonArrayType | {}, cache: ITypeCacheInternal): TypeMetadata;
30
- parse(schema: IJsonSimpleType | IJsonReferenceType | IJsonArrayType | {}, cache: ITypeCacheInternal): void;
29
+ static create(schema: IJsonSimpleType | IJsonReferenceType | IJsonArrayType | {}, cache: TypeCache): TypeMetadata;
30
+ parse(schema: IJsonSimpleType | IJsonReferenceType | IJsonArrayType | {}, cache: TypeCache): void;
31
31
  /**
32
32
  * Get a basic type from a json schema string type.
33
33
  */
@@ -46,10 +46,15 @@ var TypeMetadata = /** @class */ (function () {
46
46
  }
47
47
  else if (schema.oneOf) {
48
48
  var types = schema.oneOf;
49
- var basicType = types.find(function (c) { return c.type; });
50
- var refType = types.find(function (c) { return c.$ref; });
51
- if ((basicType === null || basicType === void 0 ? void 0 : basicType.type) === "null" && refType) {
52
- this.parse(refType, cache);
49
+ if (types.length === 1) {
50
+ this.parse(types[0], cache);
51
+ }
52
+ else {
53
+ var basicType = types.find(function (c) { return c.type; });
54
+ var refType = types.find(function (c) { return c.$ref; });
55
+ if ((basicType === null || basicType === void 0 ? void 0 : basicType.type) === "null" && refType) {
56
+ this.parse(refType, cache);
57
+ }
53
58
  }
54
59
  }
55
60
  else if (schema.allOf) {
@@ -148,7 +153,7 @@ var TypeMetadata = /** @class */ (function () {
148
153
  type.customType = new ClassMetadata(parentKey);
149
154
  for (var propertyKey in data) {
150
155
  var propertyType = TypeMetadata.fromData(data[propertyKey], propertyKey, maxDepth - 1);
151
- var propertyInfo = new PropertyMetadata(propertyKey, propertyType);
156
+ var propertyInfo = new PropertyMetadata(propertyKey, propertyType, type.customType);
152
157
  type.customType.properties.push(propertyInfo);
153
158
  if (propertyType.basicType !== "unknown") {
154
159
  if (propertyType.basicType === "array") {
@@ -6,6 +6,7 @@ import { ContainerValidationState } from '../ValidationState';
6
6
  import PropertyValidator from './PropertyValidator';
7
7
  import { ValidationDisplayInfo } from '../DisplayHelper';
8
8
  import { IRuleResult } from '../RuleContext';
9
+ import { IInvalidObjectGraph } from "../ValidationHelpers";
9
10
  export default class ModelValidator implements IModelValidator {
10
11
  private model;
11
12
  private ruleProperties;
@@ -27,9 +28,13 @@ export default class ModelValidator implements IModelValidator {
27
28
  get severity(): import("../ValidationState").RuleSeverity;
28
29
  private checkRules;
29
30
  /**
30
- * Gets the broken rules for this object. If you need the summary for an object graph, use Validation.getValidationSummary()
31
+ * Gets the broken rules for this object (not its children). If you need children included, use `getBrokenRulesGraph()`.
31
32
  */
32
33
  getBrokenRules(): IInvalidObject;
34
+ /**
35
+ * Gets a full graph of broken rules for this object and all child objects.
36
+ */
37
+ getBrokenRulesGraph(): IInvalidObjectGraph | null;
33
38
  getRuleResult(ruleDefinition: IRule | null): IRuleResult | null;
34
39
  resetDisplay(): void;
35
40
  }
@@ -7,6 +7,7 @@ import PropertyValidator from './PropertyValidator';
7
7
  import PropertyInfo from '../../Model/PropertyInfo';
8
8
  import ValidationDisplayHelper from '../DisplayHelper';
9
9
  import { NeoTypeInfo } from '../../Model/NeoTypeInfo';
10
+ import { getValidationSummary } from "../ValidationHelpers";
10
11
  var ModelValidator = /** @class */ (function () {
11
12
  function ModelValidator(model, objectRules) {
12
13
  var _this = this;
@@ -93,7 +94,7 @@ var ModelValidator = /** @class */ (function () {
93
94
  });
94
95
  };
95
96
  /**
96
- * Gets the broken rules for this object. If you need the summary for an object graph, use Validation.getValidationSummary()
97
+ * Gets the broken rules for this object (not its children). If you need children included, use `getBrokenRulesGraph()`.
97
98
  */
98
99
  ModelValidator.prototype.getBrokenRules = function () {
99
100
  var ruleState = this.ruleState;
@@ -118,6 +119,12 @@ var ModelValidator = /** @class */ (function () {
118
119
  propertyRules: properties
119
120
  };
120
121
  };
122
+ /**
123
+ * Gets a full graph of broken rules for this object and all child objects.
124
+ */
125
+ ModelValidator.prototype.getBrokenRulesGraph = function () {
126
+ return getValidationSummary(this.model);
127
+ };
121
128
  ModelValidator.prototype.getRuleResult = function (ruleDefinition) {
122
129
  if (ruleDefinition) {
123
130
  var rule = this.objectRules.find(function (c) { return c.ruleId === ruleDefinition.ruleId; });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,16 +15,17 @@
15
15
  "author": "Singular Systems",
16
16
  "license": "ISC",
17
17
  "devDependencies": {
18
- "@types/jest": "29.5.14",
19
- "@types/node": "22.15.30",
18
+ "@types/jest": "30.0.0",
19
+ "@types/node": "24.7.2",
20
20
  "decimal.js-light": "2.5.1",
21
- "jest": "29.7.0",
22
- "ts-jest": "29.3.4",
21
+ "jest": "30.2.0",
22
+ "jest-util": "30.2.0",
23
+ "ts-jest": "29.4.5",
23
24
  "typescript": "5.7.3"
24
25
  },
25
26
  "dependencies": {
26
- "@microsoft/signalr": "8.0.7",
27
- "axios": "1.7.9",
27
+ "@microsoft/signalr": "9.0.6",
28
+ "axios": "1.12.2",
28
29
  "inversify": "6.0.2",
29
30
  "reflect-metadata": "0.2.2",
30
31
  "tslib": "2.8.1"