@api-client/core 0.18.29 → 0.18.31

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.
@@ -42062,19 +42062,19 @@
42062
42062
  "@id": "#209"
42063
42063
  },
42064
42064
  {
42065
- "@id": "#200"
42065
+ "@id": "#191"
42066
42066
  },
42067
42067
  {
42068
- "@id": "#203"
42068
+ "@id": "#194"
42069
42069
  },
42070
42070
  {
42071
- "@id": "#191"
42071
+ "@id": "#200"
42072
42072
  },
42073
42073
  {
42074
42074
  "@id": "#197"
42075
42075
  },
42076
42076
  {
42077
- "@id": "#194"
42077
+ "@id": "#203"
42078
42078
  },
42079
42079
  {
42080
42080
  "@id": "#206"
@@ -42813,13 +42813,13 @@
42813
42813
  "@id": "#210"
42814
42814
  },
42815
42815
  {
42816
- "@id": "#219"
42817
- },
42818
- {
42819
42816
  "@id": "#213"
42820
42817
  },
42821
42818
  {
42822
42819
  "@id": "#216"
42820
+ },
42821
+ {
42822
+ "@id": "#219"
42823
42823
  }
42824
42824
  ],
42825
42825
  "doc:root": false,
@@ -43436,7 +43436,7 @@
43436
43436
  "doc:ExternalDomainElement",
43437
43437
  "doc:DomainElement"
43438
43438
  ],
43439
- "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43439
+ "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43440
43440
  "core:mediaType": "application/yaml",
43441
43441
  "sourcemaps:sources": [
43442
43442
  {
@@ -43457,7 +43457,7 @@
43457
43457
  "doc:ExternalDomainElement",
43458
43458
  "doc:DomainElement"
43459
43459
  ],
43460
- "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43460
+ "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43461
43461
  "core:mediaType": "application/yaml",
43462
43462
  "sourcemaps:sources": [
43463
43463
  {
@@ -43499,7 +43499,7 @@
43499
43499
  "doc:ExternalDomainElement",
43500
43500
  "doc:DomainElement"
43501
43501
  ],
43502
- "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\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": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43523
+ "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43524
43524
  "core:mediaType": "application/yaml",
43525
43525
  "sourcemaps:sources": [
43526
43526
  {
@@ -44253,7 +44253,7 @@
44253
44253
  "doc:ExternalDomainElement",
44254
44254
  "doc:DomainElement"
44255
44255
  ],
44256
- "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\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
  {
@@ -44274,7 +44274,7 @@
44274
44274
  "doc:ExternalDomainElement",
44275
44275
  "doc:DomainElement"
44276
44276
  ],
44277
- "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
44277
+ "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
44278
44278
  "core:mediaType": "application/yaml",
44279
44279
  "sourcemaps:sources": [
44280
44280
  {
@@ -44295,7 +44295,7 @@
44295
44295
  "doc:ExternalDomainElement",
44296
44296
  "doc:DomainElement"
44297
44297
  ],
44298
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44298
+ "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
44299
44299
  "core:mediaType": "application/yaml",
44300
44300
  "sourcemaps:sources": [
44301
44301
  {
@@ -44756,12 +44756,12 @@
44756
44756
  {
44757
44757
  "@id": "#193/source-map/lexical/element_0",
44758
44758
  "sourcemaps:element": "amf://id#193",
44759
- "sourcemaps:value": "[(1,0)-(3,0)]"
44759
+ "sourcemaps:value": "[(1,0)-(7,0)]"
44760
44760
  },
44761
44761
  {
44762
44762
  "@id": "#196/source-map/lexical/element_0",
44763
44763
  "sourcemaps:element": "amf://id#196",
44764
- "sourcemaps:value": "[(1,0)-(3,0)]"
44764
+ "sourcemaps:value": "[(1,0)-(10,0)]"
44765
44765
  },
44766
44766
  {
44767
44767
  "@id": "#199/source-map/lexical/element_0",
@@ -44771,12 +44771,12 @@
44771
44771
  {
44772
44772
  "@id": "#202/source-map/lexical/element_0",
44773
44773
  "sourcemaps:element": "amf://id#202",
44774
- "sourcemaps:value": "[(1,0)-(7,0)]"
44774
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44775
44775
  },
44776
44776
  {
44777
44777
  "@id": "#205/source-map/lexical/element_0",
44778
44778
  "sourcemaps:element": "amf://id#205",
44779
- "sourcemaps:value": "[(1,0)-(10,0)]"
44779
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44780
44780
  },
44781
44781
  {
44782
44782
  "@id": "#208/source-map/lexical/element_0",
@@ -45121,17 +45121,17 @@
45121
45121
  {
45122
45122
  "@id": "#215/source-map/lexical/element_0",
45123
45123
  "sourcemaps:element": "amf://id#215",
45124
- "sourcemaps:value": "[(1,0)-(7,0)]"
45124
+ "sourcemaps:value": "[(1,0)-(6,0)]"
45125
45125
  },
45126
45126
  {
45127
45127
  "@id": "#218/source-map/lexical/element_0",
45128
45128
  "sourcemaps:element": "amf://id#218",
45129
- "sourcemaps:value": "[(1,0)-(3,0)]"
45129
+ "sourcemaps:value": "[(1,0)-(7,0)]"
45130
45130
  },
45131
45131
  {
45132
45132
  "@id": "#221/source-map/lexical/element_0",
45133
45133
  "sourcemaps:element": "amf://id#221",
45134
- "sourcemaps:value": "[(1,0)-(6,0)]"
45134
+ "sourcemaps:value": "[(1,0)-(3,0)]"
45135
45135
  },
45136
45136
  {
45137
45137
  "@id": "#338/source-map/synthesized-field/element_1",
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.29",
4
+ "version": "0.18.31",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -104,8 +104,8 @@
104
104
  "xpath": "^0.0.34"
105
105
  },
106
106
  "devDependencies": {
107
- "@commitlint/cli": "^19.3.0",
108
- "@commitlint/config-conventional": "^19.2.2",
107
+ "@commitlint/cli": "^20.1.0",
108
+ "@commitlint/config-conventional": "^20.0.0",
109
109
  "@eslint/js": "^9.20.0",
110
110
  "@japa/api-client": "^3.0.3",
111
111
  "@japa/assert": "^4.0.1",
@@ -116,7 +116,7 @@
116
116
  "@rollup/plugin-typescript": "^12.1.2",
117
117
  "@types/cors": "^2.8.12",
118
118
  "@types/express-ntlm": "^2.3.3",
119
- "@types/jsdom": "^21.1.7",
119
+ "@types/jsdom": "^27.0.0",
120
120
  "@types/json-schema": "^7.0.15",
121
121
  "@types/mocha": "^10.0.10",
122
122
  "@types/node": "^24.0.1",
@@ -401,12 +401,20 @@ export class ApiModel extends DependentModel {
401
401
  throw new Error(`Entity not found in domain: ${entity.key}`)
402
402
  }
403
403
  const name = domainEntity.info.name || ''
404
+ const segment = pluralize(name.toLocaleLowerCase())
405
+ const relativeCollectionPath = `/${segment}`
406
+ const relativeResourcePath = `/${segment}/{id}`
407
+ const absoluteCollectionPath = relativeCollectionPath
408
+ const absoluteResourcePath = relativeResourcePath
404
409
  const newEntity: ExposedEntity = {
405
410
  key: nanoid(),
406
411
  entity: { ...entity },
407
412
  actions: [],
408
413
  isRoot: true,
409
- path: pluralize(name.toLocaleLowerCase()),
414
+ relativeCollectionPath,
415
+ relativeResourcePath,
416
+ absoluteCollectionPath,
417
+ absoluteResourcePath,
410
418
  }
411
419
  if (options) {
412
420
  newEntity.exposeOptions = { ...options }
@@ -479,13 +487,24 @@ export class ApiModel extends DependentModel {
479
487
  if (!targetDomainEntity) continue
480
488
 
481
489
  const name = association.info.name || ''
490
+ const parentExposure = this.exposes.find((e) => e.key === parentKey)
491
+ const parentAbsResource = parentExposure?.absoluteResourcePath || ''
492
+ const segment = pluralize(name.toLocaleLowerCase())
493
+ const isCollection = association.multiple !== false
494
+ const relativeCollectionPath = isCollection ? `/${segment}` : undefined
495
+ const relativeResourcePath = isCollection ? `/${segment}/{id}` : `/${segment}`
496
+ const absoluteCollectionPath = isCollection ? `${parentAbsResource}${relativeCollectionPath}` : undefined
497
+ const absoluteResourcePath = `${parentAbsResource}${relativeResourcePath}`
482
498
  // Create nested exposure
483
499
  const nestedExposure: ExposedEntity = {
484
500
  key: nanoid(),
485
501
  entity: { ...target },
486
502
  actions: [],
487
503
  isRoot: false,
488
- path: pluralize(name.toLocaleLowerCase()),
504
+ relativeCollectionPath,
505
+ relativeResourcePath,
506
+ absoluteCollectionPath,
507
+ absoluteResourcePath,
489
508
  parent: {
490
509
  key: parentKey,
491
510
  association: {
@@ -449,9 +449,28 @@ export interface ExposedEntity {
449
449
  */
450
450
  entity: AssociationTarget
451
451
  /**
452
- * The path segment for this exposure.
452
+ * Relative path to the collection endpoint for this exposure.
453
+ * Starts with '/'. Not set for 1:1 nested exposures where collection does not exist.
453
454
  */
454
- path: string
455
+ relativeCollectionPath?: string
456
+
457
+ /**
458
+ * Relative path to the resource endpoint for this exposure.
459
+ * Starts with '/'. For 1:1 nested exposures the resource path typically does not include an id segment.
460
+ */
461
+ relativeResourcePath: string
462
+
463
+ /**
464
+ * Absolute path to the collection endpoint for this exposure (includes parent paths).
465
+ * Starts with '/'. Not set for 1:1 nested exposures where collection does not exist.
466
+ */
467
+ absoluteCollectionPath?: string
468
+
469
+ /**
470
+ * Absolute path to the resource endpoint for this exposure (includes parent paths).
471
+ * Starts with '/'.
472
+ */
473
+ absoluteResourcePath: string
455
474
 
456
475
  /**
457
476
  * Whether this exposure is a root exposure (top-level collection).
@@ -766,9 +785,9 @@ export interface MatchUserPropertyAccessRule extends BaseAccessRule {
766
785
  export interface MatchEmailDomainAccessRule extends BaseAccessRule {
767
786
  type: 'matchEmailDomain'
768
787
  /**
769
- * The email domain that the authenticated user's email must match.
788
+ * The email domains that the authenticated user's email must match.
770
789
  */
771
- domain: string
790
+ domains: string[]
772
791
  }
773
792
 
774
793
  /**
@@ -81,7 +81,8 @@ test.group('ApiModel.exposeEntity()', () => {
81
81
  const nestedB = model.exposes.find((e) => !e.isRoot && e.entity.key === eB.key)
82
82
  assert.isDefined(nestedB)
83
83
  assert.deepEqual(nestedB?.parent?.key, exposedA.key)
84
- assert.strictEqual(nestedB?.path, 'entitybs')
84
+ assert.strictEqual(nestedB?.relativeCollectionPath, '/entitybs')
85
+ assert.strictEqual(nestedB?.absoluteCollectionPath, '/as/{id}/entitybs')
85
86
  })
86
87
 
87
88
  test('does not infinitely expose circular associations', ({ assert }) => {