@singularsystems/neo-core 1.3.3 → 1.3.5

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,13 @@
1
+ # Neo core changelog
1
2
 
3
+ ## Version 1.3.5 (30 Oct 2025)
2
4
 
3
- # Breaking changes
5
+ - PageManager
6
+ - Fixed an issue with the total number of records that would affect the page controls display.
4
7
 
5
- ## 0.10.65 (6 March 2023)
8
+ ## Version 1.3.4 (15 Oct 2025)
6
9
 
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`.
10
+ - JsonSchema
11
+ - Property info - added a reference to the property's parent class.
12
+ - ModelBase
13
+ - Added `getBrokenRulesGraph` method to the model validator. This can be used instead of the separate `Validation.getValidationSummary` helper method.
@@ -98,7 +98,8 @@ export declare class PageManager<TCriteria extends ValueObject, TModel extends I
98
98
  taskRunner: ITaskRunner;
99
99
  private hasInitialised;
100
100
  private pageRequest;
101
- private _totalExternalRecords;
101
+ private _loadedPageRecords;
102
+ private _totalRecords;
102
103
  private currentData;
103
104
  private initialFetchState;
104
105
  private isInvalidated;
@@ -13,7 +13,8 @@ var PageManager = /** @class */ (function (_super) {
13
13
  _this.modelType = modelType;
14
14
  _this.dataSource = dataSource;
15
15
  _this.hasInitialised = false;
16
- _this._totalExternalRecords = -1;
16
+ _this._loadedPageRecords = 0;
17
+ _this._totalRecords = 0;
17
18
  _this.currentData = new List(_this.modelType);
18
19
  _this.initialFetchState = "none";
19
20
  _this.isInvalidated = false;
@@ -104,7 +105,7 @@ var PageManager = /** @class */ (function (_super) {
104
105
  });
105
106
  Object.defineProperty(PageManager.prototype, "totalRecords", {
106
107
  get: function () {
107
- return this._totalExternalRecords + this.data.length;
108
+ return this._totalRecords - this._loadedPageRecords + this.data.length;
108
109
  },
109
110
  enumerable: false,
110
111
  configurable: true
@@ -238,8 +239,9 @@ var PageManager = /** @class */ (function (_super) {
238
239
  return __generator(this, function (_a) {
239
240
  switch (_a.label) {
240
241
  case 0:
242
+ this._loadedPageRecords = pageRecords.length;
241
243
  if (totalRecords >= 0) {
242
- this._totalExternalRecords = totalRecords - pageRecords.length;
244
+ this._totalRecords = totalRecords;
243
245
  }
244
246
  newData = List.fromJSArray(this.modelType, pageRecords, this.options.deserialiseOptions);
245
247
  if (!this.options.afterFetch) return [3 /*break*/, 2];
@@ -274,7 +276,8 @@ var PageManager = /** @class */ (function (_super) {
274
276
  PageManager.prototype.reset = function () {
275
277
  this.initialFetchState = "none";
276
278
  this.data.set([]);
277
- this._totalExternalRecords = 0;
279
+ this._totalRecords = 0;
280
+ this._loadedPageRecords = 0;
278
281
  };
279
282
  /**
280
283
  * Resets the sort properties. A new sort property can be provided.
@@ -350,7 +353,11 @@ var PageManager = /** @class */ (function (_super) {
350
353
  __decorate([
351
354
  Observable(),
352
355
  __metadata("design:type", Number)
353
- ], PageManager.prototype, "_totalExternalRecords", void 0);
356
+ ], PageManager.prototype, "_loadedPageRecords", void 0);
357
+ __decorate([
358
+ Observable(),
359
+ __metadata("design:type", Number)
360
+ ], PageManager.prototype, "_totalRecords", void 0);
354
361
  __decorate([
355
362
  Observable(),
356
363
  __metadata("design:type", Object)
@@ -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.5",
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"