@api-client/core 0.18.0 → 0.18.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.
@@ -42071,15 +42071,15 @@
42071
42071
  "@id": "#197"
42072
42072
  },
42073
42073
  {
42074
- "@id": "#206"
42075
- },
42076
- {
42077
42074
  "@id": "#200"
42078
42075
  },
42079
42076
  {
42080
42077
  "@id": "#203"
42081
42078
  },
42082
42079
  {
42080
+ "@id": "#206"
42081
+ },
42082
+ {
42083
42083
  "@id": "#209"
42084
42084
  }
42085
42085
  ],
@@ -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": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\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": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
43523
+ "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43524
43524
  "core:mediaType": "application/yaml",
43525
43525
  "sourcemaps:sources": [
43526
43526
  {
@@ -43541,7 +43541,7 @@
43541
43541
  "doc:ExternalDomainElement",
43542
43542
  "doc:DomainElement"
43543
43543
  ],
43544
- "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43544
+ "doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
43545
43545
  "core:mediaType": "application/yaml",
43546
43546
  "sourcemaps:sources": [
43547
43547
  {
@@ -44771,17 +44771,17 @@
44771
44771
  {
44772
44772
  "@id": "#202/source-map/lexical/element_0",
44773
44773
  "sourcemaps:element": "amf://id#202",
44774
- "sourcemaps:value": "[(1,0)-(3,0)]"
44774
+ "sourcemaps:value": "[(1,0)-(5,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)-(6,0)]"
44779
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44780
44780
  },
44781
44781
  {
44782
44782
  "@id": "#208/source-map/lexical/element_0",
44783
44783
  "sourcemaps:element": "amf://id#208",
44784
- "sourcemaps:value": "[(1,0)-(5,0)]"
44784
+ "sourcemaps:value": "[(1,0)-(6,0)]"
44785
44785
  },
44786
44786
  {
44787
44787
  "@id": "#223/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.0",
4
+ "version": "0.18.2",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -12,7 +12,40 @@ import type {
12
12
  UsernamePasswordConfiguration,
13
13
  } from './types.js'
14
14
  import { DataDomain } from './DataDomain.js'
15
- import { DependentModel, type DomainDependency, type DependentModelSchema } from './DependentModel.js'
15
+ import { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js'
16
+ import { observed, toRaw } from './observed.js'
17
+
18
+ /**
19
+ * Contact information for the exposed API.
20
+ */
21
+ export interface ApiContact {
22
+ /**
23
+ * The identifying name of the contact person/organization.
24
+ */
25
+ name?: string
26
+ /**
27
+ * The URL pointing to the contact information. MUST be in the format of a URL.
28
+ */
29
+ url?: string
30
+ /**
31
+ * The email address of the contact person/organization. MUST be in the format of an email address.
32
+ */
33
+ email?: string
34
+ }
35
+
36
+ /**
37
+ * License information for the exposed API.
38
+ */
39
+ export interface ApiLicense {
40
+ /**
41
+ * The license name used for the API. It is recommended to be an SPDX license identifier.
42
+ */
43
+ name: string
44
+ /**
45
+ * A URL to the license used for the API. MUST be in the format of a URL.
46
+ */
47
+ url?: string
48
+ }
16
49
 
17
50
  export interface ApiModelSchema extends DependentModelSchema {
18
51
  /**
@@ -74,6 +107,18 @@ export interface ApiModelSchema extends DependentModelSchema {
74
107
  * Defines rules to protect the API from overuse.
75
108
  */
76
109
  rateLimiting?: RateLimitingConfiguration
110
+ /**
111
+ * A URL to the Terms of Service for the API.
112
+ */
113
+ termsOfService?: string
114
+ /**
115
+ * The contact information for the exposed API.
116
+ */
117
+ contact?: ApiContact
118
+ /**
119
+ * The license information for the API.
120
+ */
121
+ license?: ApiLicense
77
122
  }
78
123
 
79
124
  export class ApiModel extends DependentModel {
@@ -135,6 +180,18 @@ export class ApiModel extends DependentModel {
135
180
  * Defines rules to protect the API from overuse.
136
181
  */
137
182
  rateLimiting?: RateLimitingConfiguration
183
+ /**
184
+ * A URL to the Terms of Service for the API.
185
+ */
186
+ @observed() accessor termsOfService: string | undefined
187
+ /**
188
+ * The contact information for the exposed API.
189
+ */
190
+ @observed({ deep: true }) accessor contact: ApiContact | undefined
191
+ /**
192
+ * The license information for the API.
193
+ */
194
+ @observed({ deep: true }) accessor license: ApiLicense | undefined
138
195
 
139
196
  /**
140
197
  * When the initializing flag is set to true,
@@ -196,6 +253,15 @@ export class ApiModel extends DependentModel {
196
253
  if (input.rateLimiting) {
197
254
  result.rateLimiting = input.rateLimiting
198
255
  }
256
+ if (input.termsOfService) {
257
+ result.termsOfService = input.termsOfService
258
+ }
259
+ if (input.contact) {
260
+ result.contact = structuredClone(input.contact)
261
+ }
262
+ if (input.license) {
263
+ result.license = structuredClone(input.license)
264
+ }
199
265
  return result
200
266
  }
201
267
 
@@ -234,6 +300,15 @@ export class ApiModel extends DependentModel {
234
300
  if (init.rateLimiting) {
235
301
  this.rateLimiting = structuredClone(init.rateLimiting)
236
302
  }
303
+ if (init.termsOfService) {
304
+ this.termsOfService = init.termsOfService
305
+ }
306
+ if (init.contact) {
307
+ this.contact = init.contact
308
+ }
309
+ if (init.license) {
310
+ this.license = init.license
311
+ }
237
312
  this.#initializing = false
238
313
  this.info.addEventListener('change', () => {
239
314
  this.notifyChange()
@@ -268,6 +343,15 @@ export class ApiModel extends DependentModel {
268
343
  if (this.rateLimiting) {
269
344
  result.rateLimiting = structuredClone(this.rateLimiting)
270
345
  }
346
+ if (this.termsOfService) {
347
+ result.termsOfService = this.termsOfService
348
+ }
349
+ if (this.contact) {
350
+ result.contact = structuredClone(toRaw(this, this.contact))
351
+ }
352
+ if (this.license) {
353
+ result.license = structuredClone(toRaw(this, this.license))
354
+ }
271
355
  return result
272
356
  }
273
357
 
@@ -1,3 +1,4 @@
1
+ import type { DataCatalogLifecycle } from './DataCatalogVersion.js'
1
2
  import { DataCatalogKind } from './kinds.js'
2
3
 
3
4
  export type DataCatalogScope = 'public' | 'private' | 'organization'
@@ -102,6 +103,17 @@ export interface DataCatalogSchema {
102
103
  tags: string[]
103
104
  }
104
105
 
106
+ export interface DataCatalogSchemaVersion {
107
+ /**
108
+ * The version of the data catalog entry.
109
+ */
110
+ version: string
111
+ /**
112
+ * The lifecycle of the data catalog version.
113
+ */
114
+ lifecycle: DataCatalogLifecycle
115
+ }
116
+
105
117
  /**
106
118
  * Used with API communication when listing data catalog entries.
107
119
  */
@@ -110,7 +122,7 @@ export interface DataCatalogSchemaWithVersion extends DataCatalogSchema {
110
122
  * The list of published versions of the data catalog entry.
111
123
  * Note, this is limited to the last 20 versions.
112
124
  */
113
- versions: string[]
125
+ versions: DataCatalogSchemaVersion[]
114
126
  }
115
127
 
116
128
  export interface DataCatalogVersionInfo {
@@ -6,6 +6,8 @@ import {
6
6
  type RolesBasedAccessControl,
7
7
  type ApiModelSchema,
8
8
  type ExposedEntity,
9
+ type ApiContact,
10
+ type ApiLicense,
9
11
  } from '../../../src/index.js'
10
12
 
11
13
  test.group('ApiModel.createSchema()', (g) => {
@@ -26,6 +28,9 @@ test.group('ApiModel.createSchema()', (g) => {
26
28
  assert.isUndefined(schema.session)
27
29
  assert.isUndefined(schema.accessRule)
28
30
  assert.isUndefined(schema.rateLimiting)
31
+ assert.isUndefined(schema.termsOfService)
32
+ assert.isUndefined(schema.contact)
33
+ assert.isUndefined(schema.license)
29
34
  })
30
35
 
31
36
  test('creates a schema with provided values', ({ assert }) => {
@@ -40,6 +45,9 @@ test.group('ApiModel.createSchema()', (g) => {
40
45
  session: { secret: 'secret', properties: ['email'] },
41
46
  accessRule: [{ type: 'public' }],
42
47
  rateLimiting: { rules: [] },
48
+ termsOfService: 'https://example.com/terms',
49
+ contact: { name: 'John Doe', email: 'john.doe@example.com' } as ApiContact,
50
+ license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' } as ApiLicense,
43
51
  }
44
52
  const schema = ApiModel.createSchema(input)
45
53
 
@@ -54,6 +62,9 @@ test.group('ApiModel.createSchema()', (g) => {
54
62
  assert.deepEqual(schema.session, { secret: 'secret', properties: ['email'] })
55
63
  assert.deepEqual(schema.accessRule, [{ type: 'public' }])
56
64
  assert.deepEqual(schema.rateLimiting, { rules: [] })
65
+ assert.equal(schema.termsOfService, 'https://example.com/terms')
66
+ assert.deepEqual(schema.contact, { name: 'John Doe', email: 'john.doe@example.com' })
67
+ assert.deepEqual(schema.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
57
68
  })
58
69
 
59
70
  test('creates a schema with partial info', ({ assert }) => {
@@ -85,6 +96,9 @@ test.group('ApiModel.constructor()', (g) => {
85
96
  assert.isUndefined(model.session)
86
97
  assert.isUndefined(model.accessRule)
87
98
  assert.isUndefined(model.rateLimiting)
99
+ assert.isUndefined(model.termsOfService)
100
+ assert.isUndefined(model.contact)
101
+ assert.isUndefined(model.license)
88
102
  assert.deepEqual(model.dependencyList, [])
89
103
  })
90
104
 
@@ -101,6 +115,9 @@ test.group('ApiModel.constructor()', (g) => {
101
115
  session: { secret: 'secret', properties: ['email'] },
102
116
  accessRule: [{ type: 'public' }],
103
117
  rateLimiting: { rules: [] },
118
+ termsOfService: 'https://example.com/terms',
119
+ contact: { name: 'John Doe', email: 'john.doe@example.com' },
120
+ license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' },
104
121
  }
105
122
  const model = new ApiModel(schema)
106
123
 
@@ -114,6 +131,9 @@ test.group('ApiModel.constructor()', (g) => {
114
131
  assert.deepEqual(model.session, { secret: 'secret', properties: ['email'] })
115
132
  assert.deepEqual(model.accessRule, [{ type: 'public' }])
116
133
  assert.deepEqual(model.rateLimiting, { rules: [] })
134
+ assert.equal(model.termsOfService, 'https://example.com/terms')
135
+ assert.deepEqual(model.contact, { name: 'John Doe', email: 'john.doe@example.com' })
136
+ assert.deepEqual(model.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
117
137
  })
118
138
 
119
139
  test('creates an instance with a DataDomain', ({ assert }) => {
@@ -159,6 +179,9 @@ test.group('ApiModel.toJSON()', (g) => {
159
179
  assert.isUndefined(json.session)
160
180
  assert.isUndefined(json.accessRule)
161
181
  assert.isUndefined(json.rateLimiting)
182
+ assert.isUndefined(json.termsOfService)
183
+ assert.isUndefined(json.contact)
184
+ assert.isUndefined(json.license)
162
185
  })
163
186
 
164
187
  test('serializes all provided values', ({ assert }) => {
@@ -174,6 +197,9 @@ test.group('ApiModel.toJSON()', (g) => {
174
197
  session: { secret: 'secret', properties: ['email'] },
175
198
  accessRule: [{ type: 'public' }],
176
199
  rateLimiting: { rules: [] },
200
+ termsOfService: 'https://example.com/terms',
201
+ contact: { name: 'John Doe', email: 'john.doe@example.com' },
202
+ license: { name: 'MIT', url: 'https://opensource.org/licenses/MIT' },
177
203
  }
178
204
  const model = new ApiModel(schema)
179
205
  const json = model.toJSON()
@@ -188,6 +214,9 @@ test.group('ApiModel.toJSON()', (g) => {
188
214
  assert.deepEqual(json.session, { secret: 'secret', properties: ['email'] })
189
215
  assert.deepEqual(json.accessRule, [{ type: 'public' }])
190
216
  assert.deepEqual(json.rateLimiting, { rules: [] })
217
+ assert.equal(json.termsOfService, 'https://example.com/terms')
218
+ assert.deepEqual(json.contact, { name: 'John Doe', email: 'john.doe@example.com' })
219
+ assert.deepEqual(json.license, { name: 'MIT', url: 'https://opensource.org/licenses/MIT' })
191
220
  })
192
221
  })
193
222