@singularsystems/neo-core 1.6.1 → 1.6.3

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,5 +1,14 @@
1
1
  # Neo core changelog
2
2
 
3
+ ## Version 1.6.3 (20 July 2026)
4
+
5
+ - Fixed issue with `Utils.createInstance` not passing parameters correctly.
6
+
7
+ ## Version 1.6.2 (10 July 2026)
8
+
9
+ - PageManager
10
+ - Specifying single `sortAscending` value will now work if multiple `sortBy` properties are provided.
11
+
3
12
  ## Version 1.6.1 (23 June 2026)
4
13
 
5
14
  - Minor routing changes to support changes in neo-react.
@@ -297,11 +297,12 @@ var PageManager = /** @class */ (function (_super) {
297
297
  };
298
298
  /** Sets a single or multiple sort operations. Does not refresh data. */
299
299
  PageManager.prototype.setSortOperations = function (sortBy, sortAscending) {
300
+ var _a;
300
301
  this.sortInfo = [];
301
302
  var metaData = this.modelType.neo.meta;
302
303
  if (sortBy instanceof Array) {
303
304
  for (var i = 0; i < sortBy.length; i++) {
304
- this.sortInfo.push(new SortOperation(metaData[sortBy[i]].propertyInfo, sortAscending === undefined || sortAscending[i] !== false));
305
+ this.sortInfo.push(new SortOperation(metaData[sortBy[i]].propertyInfo, sortAscending === undefined || ((_a = sortAscending[i]) !== null && _a !== void 0 ? _a : sortAscending) !== false));
305
306
  }
306
307
  }
307
308
  else {
@@ -23,11 +23,16 @@ type TransformLists<T> = {
23
23
  type RemoveChildren<T> = Pick<T, {
24
24
  [P in keyof T]: T[P] extends List<infer I> ? never : T[P] extends IModelBase ? never : P;
25
25
  }[keyof T]>;
26
+ type TransformDeep<T> = {
27
+ [P in keyof T]: T[P] extends Array<infer I> ? (I extends object ? PlainObject<I>[] : I[]) : T[P] extends IModelBase ? PlainObject<T[P]> : T[P];
28
+ };
26
29
  export type PartialOrNull<T> = {
27
30
  [P in keyof T]?: T[P] | null;
28
31
  };
29
32
  /** Removes ModelBase properties (isNew, isDirty etc), removes methods, and changes list types to arrays. */
30
33
  export type PlainObject<T> = TransformLists<NoModelBase<T>>;
34
+ /** Like PlainObject, but also recursively transforms nested lists and child model objects into plain objects. */
35
+ export type DeepPlainObject<T> = TransformDeep<PlainObject<T>>;
31
36
  /** PlainObject plus tracking state and entity identifier. */
32
37
  export type PlainTrackedObject<T> = PlainObject<T> & {
33
38
  trackingState?: Misc.TrackingState;
@@ -197,15 +197,16 @@ var NeoTypeInfo = /** @class */ (function () {
197
197
  }
198
198
  };
199
199
  NeoTypeInfo.prototype.createInstance = function () {
200
+ var _a;
200
201
  var args = [];
201
202
  for (var _i = 0; _i < arguments.length; _i++) {
202
203
  args[_i] = arguments[_i];
203
204
  }
204
205
  if (this.wrapperConstructor) {
205
- return this.wrapperConstructor(args);
206
+ return this.wrapperConstructor.apply(this, args);
206
207
  }
207
208
  else {
208
- return new this.objectConstructor(args);
209
+ return new ((_a = this.objectConstructor).bind.apply(_a, __spreadArray([void 0], args, false)))();
209
210
  }
210
211
  };
211
212
  /** Gets the override constructor which can setup a neo model. */
package/dist/Utils.d.ts CHANGED
@@ -45,7 +45,7 @@ export declare class Utils {
45
45
  static sameTypes(type1: Function, type2: Function): boolean;
46
46
  static getTypeName(type: Function): string;
47
47
  /**
48
- * Creates an instance of a model decorated with @NeoModel. Use this in static methods on a model class that is compiled with babel (React projects).
48
+ * Creates an instance of a neo model decorated with @NeoModel. Use this in static methods on a model class that is compiled with babel (React projects).
49
49
  * @param type Type to create.
50
50
  * @param args Constructor args.
51
51
  */
package/dist/Utils.js CHANGED
@@ -78,20 +78,21 @@ var Utils = /** @class */ (function () {
78
78
  return (_a = constructor.typeName) !== null && _a !== void 0 ? _a : constructor.name;
79
79
  };
80
80
  /**
81
- * Creates an instance of a model decorated with @NeoModel. Use this in static methods on a model class that is compiled with babel (React projects).
81
+ * Creates an instance of a neo model decorated with @NeoModel. Use this in static methods on a model class that is compiled with babel (React projects).
82
82
  * @param type Type to create.
83
83
  * @param args Constructor args.
84
84
  */
85
85
  Utils.createInstance = function (type) {
86
+ var _a;
86
87
  var args = [];
87
88
  for (var _i = 1; _i < arguments.length; _i++) {
88
89
  args[_i - 1] = arguments[_i];
89
90
  }
90
91
  if (type.prototype.constructor.neo) {
91
- return ensureTypeInfo(type).neo.createInstance(args);
92
+ return (_a = ensureTypeInfo(type).neo).createInstance.apply(_a, args);
92
93
  }
93
94
  else {
94
- throw "Cannot instantiate '".concat(type.name, "' because it does not have an @NeoModel attribute.");
95
+ throw "Cannot instantiate '".concat(type.name, "' because it does not call this.makeBindable(), or this.makeObservable().");
95
96
  }
96
97
  };
97
98
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",