@accordproject/concerto-core 3.0.0-beta.1 → 3.0.0-beta.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Concerto v3.0.0-beta.1
2
+ * Concerto v3.0.0-beta.3
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License.
5
5
  * You may obtain a copy of the License at
@@ -90,7 +90,7 @@ class Field extends Property {
90
90
 
91
91
  /**
92
92
  * Returns the default value for the field or null
93
- * @return {string} the default value for the field or null
93
+ * @return {string | number} the default value for the field or null
94
94
  */
95
95
  getDefaultValue() {
96
96
  if(this.defaultValue) {
package/lib/modelutil.js CHANGED
@@ -185,6 +185,22 @@ class ModelUtil {
185
185
  return type;
186
186
  }
187
187
  }
188
+
189
+ /**
190
+ * Converts a fully qualified type name to a FQN without a namespace version.
191
+ * If the FQN is a primitive type it is returned unchanged.
192
+ * @param {string} fqn fully qualified name of a type
193
+ * @returns {string} the fully qualified name minus the namespace version
194
+ */
195
+ static removeNamespaceVersionFromFullyQualifiedName(fqn) {
196
+ if(ModelUtil.isPrimitiveType(fqn)) {
197
+ return fqn;
198
+ }
199
+ const ns = ModelUtil.getNamespace(fqn);
200
+ const { name: namespace } = ModelUtil.parseNamespace(ns);
201
+ const typeName = ModelUtil.getShortName(fqn);
202
+ return ModelUtil.getFullyQualifiedName(namespace, typeName);
203
+ }
188
204
  }
189
205
 
190
206
  module.exports = ModelUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accordproject/concerto-core",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.3",
4
4
  "description": "Core Implementation for the Concerto Modeling Language",
5
5
  "homepage": "https://github.com/accordproject/concerto",
6
6
  "engines": {
@@ -68,9 +68,9 @@
68
68
  "yargs": "17.3.1"
69
69
  },
70
70
  "dependencies": {
71
- "@accordproject/concerto-cto": "3.0.0-beta.1",
72
- "@accordproject/concerto-metamodel": "3.0.0-beta.1",
73
- "@accordproject/concerto-util": "3.0.0-beta.1",
71
+ "@accordproject/concerto-cto": "3.0.0-beta.3",
72
+ "@accordproject/concerto-metamodel": "3.0.0-beta.3",
73
+ "@accordproject/concerto-util": "3.0.0-beta.3",
74
74
  "dayjs": "1.10.8",
75
75
  "debug": "4.3.1",
76
76
  "lorem-ipsum": "2.0.3",
@@ -139,9 +139,9 @@
139
139
  "exclude": [],
140
140
  "all": true,
141
141
  "check-coverage": true,
142
- "statements": 98,
143
- "branches": 97,
144
- "functions": 97,
145
- "lines": 98
142
+ "statements": 99,
143
+ "branches": 98,
144
+ "functions": 98,
145
+ "lines": 99
146
146
  }
147
147
  }
@@ -19,9 +19,9 @@ declare class Field extends Property {
19
19
  getValidator(): Validator;
20
20
  /**
21
21
  * Returns the default value for the field or null
22
- * @return {string} the default value for the field or null
22
+ * @return {string | number} the default value for the field or null
23
23
  */
24
- getDefaultValue(): string;
24
+ getDefaultValue(): string | number;
25
25
  /**
26
26
  * Returns true if this class is the definition of a field.
27
27
  *
@@ -98,4 +98,11 @@ declare class ModelUtil {
98
98
  * @returns {string} the fully qualified type name.
99
99
  */
100
100
  static getFullyQualifiedName(namespace: string, type: string): string;
101
+ /**
102
+ * Converts a fully qualified type name to a FQN without a namespace version.
103
+ * If the FQN is a primitive type it is returned unchanged.
104
+ * @param {string} fqn fully qualified name of a type
105
+ * @returns {string} the fully qualified name minus the namespace version
106
+ */
107
+ static removeNamespaceVersionFromFullyQualifiedName(fqn: string): string;
101
108
  }