@singularsystems/neo-core 1.0.0-beta.1 → 1.0.0-beta.2

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.
@@ -1,7 +1,8 @@
1
1
  import { PropertyMetadata } from './PropertyMetadata';
2
2
  import { IJsonObjectType } from './JsonSchemaTypes';
3
3
  import { ITypeCacheInternal } from './TypeCache';
4
- export declare class ClassMetadata {
4
+ import { MetadataBase } from './MetadataBase';
5
+ export declare class ClassMetadata extends MetadataBase {
5
6
  name: string;
6
7
  constructor(name: string);
7
8
  /**
@@ -1,31 +1,36 @@
1
+ import { __extends } from "tslib";
1
2
  import { TypeMetadata } from './TypeMetadata';
2
3
  import { PropertyMetadata } from './PropertyMetadata';
3
- var ClassMetadata = /** @class */ (function () {
4
+ import { MetadataBase } from './MetadataBase';
5
+ var ClassMetadata = /** @class */ (function (_super) {
6
+ __extends(ClassMetadata, _super);
4
7
  function ClassMetadata(name) {
5
- this.name = name;
8
+ var _this = _super.call(this) || this;
9
+ _this.name = name;
6
10
  /**
7
11
  * All properties.
8
12
  */
9
- this.properties = [];
13
+ _this.properties = [];
10
14
  /**
11
15
  * Properties excluding child objects and lists.
12
16
  */
13
- this.simpleProperties = [];
17
+ _this.simpleProperties = [];
14
18
  /**
15
19
  * Properties containing child object types.
16
20
  */
17
- this.childObjectProperties = [];
21
+ _this.childObjectProperties = [];
18
22
  /**
19
23
  * Properties containing child list types.
20
24
  */
21
- this.childListProperties = [];
25
+ _this.childListProperties = [];
26
+ return _this;
22
27
  }
23
28
  ClassMetadata.prototype.loadMetaData = function (schema, cache) {
29
+ _super.prototype.loadFromSchema.call(this, schema);
24
30
  for (var propertyKey in schema.properties) {
25
31
  var propertySchema = schema.properties[propertyKey];
26
32
  var propertyMetaData = new PropertyMetadata(propertyKey, TypeMetadata.create(propertySchema, cache));
27
- propertyMetaData.title = propertySchema.title;
28
- propertyMetaData.description = propertySchema.description;
33
+ propertyMetaData.loadFromSchema(propertySchema);
29
34
  if (propertyMetaData.type.basicType !== "unknown") {
30
35
  this.properties.push(propertyMetaData);
31
36
  if (propertyMetaData.type.basicType === "array") {
@@ -49,5 +54,5 @@ var ClassMetadata = /** @class */ (function () {
49
54
  return clone;
50
55
  };
51
56
  return ClassMetadata;
52
- }());
57
+ }(MetadataBase));
53
58
  export { ClassMetadata };
@@ -0,0 +1,8 @@
1
+ import { IJsonSchemaDescriptorType } from "./JsonSchemaTypes";
2
+ export declare class MetadataBase {
3
+ title?: string;
4
+ description?: string;
5
+ ordinal?: number;
6
+ hidden?: boolean;
7
+ loadFromSchema(schema: IJsonSchemaDescriptorType): void;
8
+ }
@@ -0,0 +1,12 @@
1
+ var MetadataBase = /** @class */ (function () {
2
+ function MetadataBase() {
3
+ }
4
+ MetadataBase.prototype.loadFromSchema = function (schema) {
5
+ this.title = schema.title;
6
+ this.description = schema.description;
7
+ this.ordinal = schema["x-ordinal"];
8
+ this.hidden = schema["x-hidden"];
9
+ };
10
+ return MetadataBase;
11
+ }());
12
+ export { MetadataBase };
@@ -1,8 +1,12 @@
1
+ import { IJsonSchemaDescriptorType } from './JsonSchemaTypes';
2
+ import { MetadataBase } from './MetadataBase';
1
3
  import { TypeMetadata } from './TypeMetadata';
2
- export declare class PropertyMetadata {
4
+ export declare class PropertyMetadata extends MetadataBase {
3
5
  propertyName: string;
4
6
  type: TypeMetadata;
5
7
  constructor(propertyName: string, type: TypeMetadata);
6
- title?: string;
7
- description?: string;
8
+ formatString?: string;
9
+ width?: number;
10
+ hAlign?: "left" | "center" | "right";
11
+ loadFromSchema(schema: IJsonSchemaDescriptorType): void;
8
12
  }
@@ -1,8 +1,19 @@
1
- var PropertyMetadata = /** @class */ (function () {
1
+ import { __extends } from "tslib";
2
+ import { MetadataBase } from './MetadataBase';
3
+ var PropertyMetadata = /** @class */ (function (_super) {
4
+ __extends(PropertyMetadata, _super);
2
5
  function PropertyMetadata(propertyName, type) {
3
- this.propertyName = propertyName;
4
- this.type = type;
6
+ var _this = _super.call(this) || this;
7
+ _this.propertyName = propertyName;
8
+ _this.type = type;
9
+ return _this;
5
10
  }
11
+ PropertyMetadata.prototype.loadFromSchema = function (schema) {
12
+ _super.prototype.loadFromSchema.call(this, schema);
13
+ this.formatString = schema["x-formatString"];
14
+ this.width = schema["x-width"];
15
+ this.hAlign = schema["x-hAlign"];
16
+ };
6
17
  return PropertyMetadata;
7
- }());
18
+ }(MetadataBase));
8
19
  export { PropertyMetadata };
@@ -20,6 +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
24
  TypeCache.prototype.getOrAddType = function (name) {
24
25
  if (name.startsWith("#/definitions/")) {
25
26
  name = name.replace("#/definitions/", "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",