@api-client/core 0.18.16 → 0.18.17

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.
@@ -42068,13 +42068,13 @@
42068
42068
  "@id": "#194"
42069
42069
  },
42070
42070
  {
42071
- "@id": "#197"
42071
+ "@id": "#200"
42072
42072
  },
42073
42073
  {
42074
- "@id": "#203"
42074
+ "@id": "#197"
42075
42075
  },
42076
42076
  {
42077
- "@id": "#200"
42077
+ "@id": "#203"
42078
42078
  },
42079
42079
  {
42080
42080
  "@id": "#206"
@@ -42810,10 +42810,10 @@
42810
42810
  "@id": "#219"
42811
42811
  },
42812
42812
  {
42813
- "@id": "#213"
42813
+ "@id": "#210"
42814
42814
  },
42815
42815
  {
42816
- "@id": "#210"
42816
+ "@id": "#213"
42817
42817
  },
42818
42818
  {
42819
42819
  "@id": "#216"
@@ -43478,7 +43478,7 @@
43478
43478
  "doc:ExternalDomainElement",
43479
43479
  "doc:DomainElement"
43480
43480
  ],
43481
- "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43481
+ "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43482
43482
  "core:mediaType": "application/yaml",
43483
43483
  "sourcemaps:sources": [
43484
43484
  {
@@ -43499,7 +43499,7 @@
43499
43499
  "doc:ExternalDomainElement",
43500
43500
  "doc:DomainElement"
43501
43501
  ],
43502
- "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43502
+ "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43503
43503
  "core:mediaType": "application/yaml",
43504
43504
  "sourcemaps:sources": [
43505
43505
  {
@@ -43520,7 +43520,7 @@
43520
43520
  "doc:ExternalDomainElement",
43521
43521
  "doc:DomainElement"
43522
43522
  ],
43523
- "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43523
+ "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43524
43524
  "core:mediaType": "application/yaml",
43525
43525
  "sourcemaps:sources": [
43526
43526
  {
@@ -44232,7 +44232,7 @@
44232
44232
  "doc:ExternalDomainElement",
44233
44233
  "doc:DomainElement"
44234
44234
  ],
44235
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44235
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
44236
44236
  "core:mediaType": "application/yaml",
44237
44237
  "sourcemaps:sources": [
44238
44238
  {
@@ -44253,7 +44253,7 @@
44253
44253
  "doc:ExternalDomainElement",
44254
44254
  "doc:DomainElement"
44255
44255
  ],
44256
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
44256
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44257
44257
  "core:mediaType": "application/yaml",
44258
44258
  "sourcemaps:sources": [
44259
44259
  {
@@ -44766,7 +44766,7 @@
44766
44766
  {
44767
44767
  "@id": "#199/source-map/lexical/element_0",
44768
44768
  "sourcemaps:element": "amf://id#199",
44769
- "sourcemaps:value": "[(1,0)-(3,0)]"
44769
+ "sourcemaps:value": "[(1,0)-(5,0)]"
44770
44770
  },
44771
44771
  {
44772
44772
  "@id": "#202/source-map/lexical/element_0",
@@ -44776,7 +44776,7 @@
44776
44776
  {
44777
44777
  "@id": "#205/source-map/lexical/element_0",
44778
44778
  "sourcemaps:element": "amf://id#205",
44779
- "sourcemaps:value": "[(1,0)-(5,0)]"
44779
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44780
44780
  },
44781
44781
  {
44782
44782
  "@id": "#208/source-map/lexical/element_0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.18.16",
4
+ "version": "0.18.17",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -8,7 +8,14 @@ import {
8
8
  DomainNamespaceKind,
9
9
  DomainPropertyKind,
10
10
  } from '../models/kinds.js'
11
- import type { AssociationAddOptions, DomainGraphEdge, DomainGraphNodeType, SerializedGraph } from './types.js'
11
+ import type {
12
+ AssociationAddOptions,
13
+ DeserializationIssue,
14
+ DeserializationMode,
15
+ DomainGraphEdge,
16
+ DomainGraphNodeType,
17
+ SerializedGraph,
18
+ } from './types.js'
12
19
  import { type DomainNamespaceSchema, DomainNamespace, type NamespaceOrderedItem } from './DomainNamespace.js'
13
20
  import { type DomainModelSchema, DomainModel } from './DomainModel.js'
14
21
  import { type DomainEntitySchema, DomainEntity } from './DomainEntity.js'
@@ -146,6 +153,12 @@ export class DataDomain extends DependentModel {
146
153
  */
147
154
  accessor fields: NamespaceOrderedItem[]
148
155
 
156
+ /**
157
+ * The list of issues encountered during deserialization.
158
+ * This is only populated when deserialization fails in lenient mode.
159
+ */
160
+ issues: DeserializationIssue[] = []
161
+
149
162
  static createSchema(input: Partial<DataDomainSchema> = {}): DataDomainSchema {
150
163
  const { key = nanoid(), fields } = input
151
164
  const info = Thing.fromJSON(input.info, { name: 'Unnamed domain' }).toJSON()
@@ -178,7 +191,7 @@ export class DataDomain extends DependentModel {
178
191
  * @param state The previously serialized state of the graph.
179
192
  * @param dependencies An array of foreign data domains to register with this domain.
180
193
  */
181
- constructor(state?: Partial<DataDomainSchema>, dependencies: DomainDependency[] = []) {
194
+ constructor(state?: Partial<DataDomainSchema>, dependencies: DomainDependency[] = [], mode?: DeserializationMode) {
182
195
  const init = DataDomain.createSchema(state)
183
196
  const instances: DataDomain[] = []
184
197
  for (const dep of dependencies) {
@@ -195,7 +208,15 @@ export class DataDomain extends DependentModel {
195
208
  this.kind = init.kind
196
209
  this.key = init.key
197
210
  this.info = new Thing(init.info)
198
- this.graph = deserialize(this, init.graph, instances)
211
+ const result = deserialize(this, {
212
+ json: init.graph,
213
+ dependencies: instances,
214
+ mode: mode || 'strict',
215
+ })
216
+ this.graph = result.graph
217
+ if (result.issues.length > 0 && mode === 'lenient') {
218
+ this.issues = result.issues
219
+ }
199
220
  if (Array.isArray(init.fields)) {
200
221
  this.fields = [...init.fields]
201
222
  } else {