@api-client/core 0.18.40 → 0.18.46
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.
- package/build/src/mocking/ModelingMock.d.ts +2 -0
- package/build/src/mocking/ModelingMock.d.ts.map +1 -1
- package/build/src/mocking/ModelingMock.js +2 -0
- package/build/src/mocking/ModelingMock.js.map +1 -1
- package/build/src/mocking/lib/DataCatalog.d.ts +53 -0
- package/build/src/mocking/lib/DataCatalog.d.ts.map +1 -0
- package/build/src/mocking/lib/DataCatalog.js +129 -0
- package/build/src/mocking/lib/DataCatalog.js.map +1 -0
- package/build/src/models/DataCatalog.d.ts +14 -0
- package/build/src/models/DataCatalog.d.ts.map +1 -1
- package/build/src/models/DataCatalog.js.map +1 -1
- package/build/src/sdk/DataCatalogSdk.d.ts +6 -6
- package/build/src/sdk/DataCatalogSdk.d.ts.map +1 -1
- package/build/src/sdk/DataCatalogSdk.js +6 -2
- package/build/src/sdk/DataCatalogSdk.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +19 -2
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +233 -2
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/package.json +4 -4
- package/src/mocking/ModelingMock.ts +2 -0
- package/src/mocking/lib/DataCatalog.ts +166 -0
- package/src/models/DataCatalog.ts +14 -0
- package/src/sdk/DataCatalogSdk.ts +9 -7
- package/src/sdk/SdkMock.ts +353 -4
- package/tests/unit/mocking/current/DataCatalog.spec.ts +449 -0
|
@@ -42813,10 +42813,10 @@
|
|
|
42813
42813
|
"@id": "#210"
|
|
42814
42814
|
},
|
|
42815
42815
|
{
|
|
42816
|
-
"@id": "#
|
|
42816
|
+
"@id": "#213"
|
|
42817
42817
|
},
|
|
42818
42818
|
{
|
|
42819
|
-
"@id": "#
|
|
42819
|
+
"@id": "#216"
|
|
42820
42820
|
},
|
|
42821
42821
|
{
|
|
42822
42822
|
"@id": "#219"
|
|
@@ -44253,7 +44253,7 @@
|
|
|
44253
44253
|
"doc:ExternalDomainElement",
|
|
44254
44254
|
"doc:DomainElement"
|
|
44255
44255
|
],
|
|
44256
|
-
"doc:raw": "
|
|
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'\
|
|
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
|
{
|
|
@@ -45121,12 +45121,12 @@
|
|
|
45121
45121
|
{
|
|
45122
45122
|
"@id": "#215/source-map/lexical/element_0",
|
|
45123
45123
|
"sourcemaps:element": "amf://id#215",
|
|
45124
|
-
"sourcemaps:value": "[(1,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)-(
|
|
45129
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
45130
45130
|
},
|
|
45131
45131
|
{
|
|
45132
45132
|
"@id": "#221/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.
|
|
4
|
+
"version": "0.18.46",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./browser.js": {
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@types/jsdom": "^27.0.0",
|
|
123
123
|
"@types/json-schema": "^7.0.15",
|
|
124
124
|
"@types/mocha": "^10.0.10",
|
|
125
|
-
"@types/node": "^
|
|
125
|
+
"@types/node": "^25.0.6",
|
|
126
126
|
"@types/sinon": "^21.0.0",
|
|
127
127
|
"@web/dev-server": "^0.4.6",
|
|
128
128
|
"@web/dev-server-rollup": "^0.6.4",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"c8": "^10.1.3",
|
|
133
133
|
"chai-as-promised": "^8.0.2",
|
|
134
134
|
"conventional-changelog": "^7.1.0",
|
|
135
|
-
"conventional-changelog-conventionalcommits": "^
|
|
135
|
+
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
136
136
|
"cors": "^2.8.5",
|
|
137
137
|
"eslint": "^9.20.1",
|
|
138
138
|
"eslint-config-prettier": "^10.0.1",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"express": "^5.1.0",
|
|
142
142
|
"express-ntlm": "^2.6.1",
|
|
143
143
|
"get-port": "^7.0.0",
|
|
144
|
-
"globals": "^
|
|
144
|
+
"globals": "^17.0.0",
|
|
145
145
|
"husky": "^9.0.11",
|
|
146
146
|
"lint-staged": "^16.0.0",
|
|
147
147
|
"oauth2-mock-server": "^8.0.0",
|
|
@@ -6,6 +6,7 @@ import { File } from './lib/File.js'
|
|
|
6
6
|
import { Invitation } from './lib/Invitation.js'
|
|
7
7
|
import { Trash } from './lib/Trash.js'
|
|
8
8
|
import { Patch } from './lib/Patch.js'
|
|
9
|
+
import { DataCatalog } from './lib/DataCatalog.js'
|
|
9
10
|
|
|
10
11
|
export class ModelingMock {
|
|
11
12
|
faker: Faker = faker
|
|
@@ -16,4 +17,5 @@ export class ModelingMock {
|
|
|
16
17
|
invitation = new Invitation()
|
|
17
18
|
trash = new Trash()
|
|
18
19
|
patch = new Patch()
|
|
20
|
+
dataCatalog = new DataCatalog()
|
|
19
21
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
|
+
import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js'
|
|
3
|
+
import { nanoid } from '../../nanoid.js'
|
|
4
|
+
import type {
|
|
5
|
+
DataCatalogSchemaWithVersion,
|
|
6
|
+
DataCatalogSchema,
|
|
7
|
+
DataCatalogScope,
|
|
8
|
+
DataCatalogVersionInfo,
|
|
9
|
+
} from '../../models/DataCatalog.js'
|
|
10
|
+
import type { DataCatalogLifecycle, DataCatalogVersionSchema } from '../../models/DataCatalogVersion.js'
|
|
11
|
+
|
|
12
|
+
const dataCatalogScopes: DataCatalogScope[] = ['public', 'private', 'organization'] as const
|
|
13
|
+
const dataCatalogLifecycles: DataCatalogLifecycle[] = ['stable', 'beta', 'dev'] as const
|
|
14
|
+
|
|
15
|
+
export class DataCatalog {
|
|
16
|
+
/**
|
|
17
|
+
* Generates a random data catalog object.
|
|
18
|
+
* @param init Optional values to be present in the object.
|
|
19
|
+
* @returns Random data catalog object.
|
|
20
|
+
*/
|
|
21
|
+
dataCatalog(init: Partial<DataCatalogSchema> = {}): DataCatalogSchema {
|
|
22
|
+
const {
|
|
23
|
+
key = nanoid(),
|
|
24
|
+
organization = nanoid(),
|
|
25
|
+
file = nanoid(),
|
|
26
|
+
scope = faker.helpers.arrayElement(dataCatalogScopes),
|
|
27
|
+
name = faker.company.name(),
|
|
28
|
+
description = faker.lorem.sentence(),
|
|
29
|
+
publishedBy = nanoid(),
|
|
30
|
+
publishedAt = faker.date.past().getTime(),
|
|
31
|
+
createdAt = faker.date.past().getTime(),
|
|
32
|
+
updatedAt = faker.date.recent().getTime(),
|
|
33
|
+
tags = faker.helpers.uniqueArray(faker.lorem.word, 3),
|
|
34
|
+
} = init
|
|
35
|
+
return {
|
|
36
|
+
kind: DataCatalogKind,
|
|
37
|
+
key,
|
|
38
|
+
name,
|
|
39
|
+
organization,
|
|
40
|
+
file,
|
|
41
|
+
createdAt,
|
|
42
|
+
updatedAt,
|
|
43
|
+
scope,
|
|
44
|
+
description,
|
|
45
|
+
publishedBy,
|
|
46
|
+
publishedAt,
|
|
47
|
+
tags,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generates a list of random data catalog objects.
|
|
53
|
+
* @param size Number of data catalogs to generate. Default is 25.
|
|
54
|
+
* @returns List of random data catalogs
|
|
55
|
+
*/
|
|
56
|
+
dataCatalogs(size = 25): DataCatalogSchema[] {
|
|
57
|
+
const result = []
|
|
58
|
+
for (let i = 0; i < size; i++) {
|
|
59
|
+
result.push(this.dataCatalog())
|
|
60
|
+
}
|
|
61
|
+
return result
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generates a random data catalog version object.
|
|
66
|
+
* @param init Optional values to be present in the object.
|
|
67
|
+
* @returns Random data catalog version object.
|
|
68
|
+
*/
|
|
69
|
+
dataCatalogVersion(init: Partial<DataCatalogVersionSchema> = {}): DataCatalogVersionSchema {
|
|
70
|
+
const {
|
|
71
|
+
key = nanoid(),
|
|
72
|
+
catalogKey = nanoid(),
|
|
73
|
+
scope = faker.helpers.arrayElement(dataCatalogScopes),
|
|
74
|
+
lifecycle = faker.helpers.arrayElement(dataCatalogLifecycles),
|
|
75
|
+
version = 'v' + faker.system.semver(),
|
|
76
|
+
publishedBy = nanoid(),
|
|
77
|
+
createdAt = faker.date.past().getTime(),
|
|
78
|
+
updatedAt = faker.date.recent().getTime(),
|
|
79
|
+
changelog = faker.lorem.paragraph(),
|
|
80
|
+
} = init
|
|
81
|
+
return {
|
|
82
|
+
kind: DataCatalogVersionKind,
|
|
83
|
+
key,
|
|
84
|
+
catalogKey,
|
|
85
|
+
scope,
|
|
86
|
+
lifecycle,
|
|
87
|
+
version,
|
|
88
|
+
publishedBy,
|
|
89
|
+
createdAt,
|
|
90
|
+
updatedAt,
|
|
91
|
+
changelog,
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Generates a list of random data catalog version objects.
|
|
97
|
+
* @param size Number of data catalog versions to generate. Default is 25.
|
|
98
|
+
* @returns List of random data catalog versions.
|
|
99
|
+
*/
|
|
100
|
+
dataCatalogVersions(size = 25): DataCatalogVersionSchema[] {
|
|
101
|
+
const result = []
|
|
102
|
+
for (let i = 0; i < size; i++) {
|
|
103
|
+
result.push(this.dataCatalogVersion())
|
|
104
|
+
}
|
|
105
|
+
return result
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Generates a random data catalog object with versions.
|
|
110
|
+
* @param init Optional values to be present in the object.
|
|
111
|
+
* @returns Random data catalog object with versions.
|
|
112
|
+
*/
|
|
113
|
+
dataCatalogWithVersion(init: Partial<DataCatalogSchemaWithVersion> = {}): DataCatalogSchemaWithVersion {
|
|
114
|
+
const result = this.dataCatalog(init) as DataCatalogSchemaWithVersion
|
|
115
|
+
const versionsSize = faker.number.int({ min: 1, max: 20 })
|
|
116
|
+
const versions = []
|
|
117
|
+
for (let i = 0; i < versionsSize; i++) {
|
|
118
|
+
versions.push({
|
|
119
|
+
version: `v${i + 1}.0.0`,
|
|
120
|
+
lifecycle: faker.helpers.arrayElement(dataCatalogLifecycles),
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
result.versions = versions
|
|
124
|
+
return result
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Generates a list of random data catalog objects with versions.
|
|
129
|
+
* @param size Number of data catalogs to generate. Default is 3.
|
|
130
|
+
* @returns List of random data catalogs with versions.
|
|
131
|
+
*/
|
|
132
|
+
dataCatalogsWithVersion(size = 3): DataCatalogSchemaWithVersion[] {
|
|
133
|
+
const result = []
|
|
134
|
+
for (let i = 0; i < size; i++) {
|
|
135
|
+
result.push(this.dataCatalogWithVersion())
|
|
136
|
+
}
|
|
137
|
+
return result
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Generates a random data catalog version info object.
|
|
142
|
+
* @param init Optional values to be present in the object.
|
|
143
|
+
* @returns Random data catalog version info object.
|
|
144
|
+
*/
|
|
145
|
+
versionInfo(init: Partial<DataCatalogVersionInfo> = {}): DataCatalogVersionInfo {
|
|
146
|
+
const { key = nanoid(), version = 'v' + faker.system.semver(), published = faker.date.past().getTime() } = init
|
|
147
|
+
return {
|
|
148
|
+
key,
|
|
149
|
+
version,
|
|
150
|
+
published,
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Generates a list of random data catalog version info objects.
|
|
156
|
+
* @param size Number of data catalog version info objects to generate. Default is 5.
|
|
157
|
+
* @returns List of random data catalog version info objects.
|
|
158
|
+
*/
|
|
159
|
+
versionInfos(size = 5): DataCatalogVersionInfo[] {
|
|
160
|
+
const result = []
|
|
161
|
+
for (let i = 0; i < size; i++) {
|
|
162
|
+
result.push(this.versionInfo())
|
|
163
|
+
}
|
|
164
|
+
return result
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -125,9 +125,23 @@ export interface DataCatalogSchemaWithVersion extends DataCatalogSchema {
|
|
|
125
125
|
versions: DataCatalogSchemaVersion[]
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Simplified information about a data catalog version.
|
|
130
|
+
* It is used when listing versions of a data catalog entry.
|
|
131
|
+
*/
|
|
128
132
|
export interface DataCatalogVersionInfo {
|
|
133
|
+
/**
|
|
134
|
+
* The key of the version.
|
|
135
|
+
*/
|
|
129
136
|
key: string
|
|
137
|
+
/**
|
|
138
|
+
* The version string according to the [semantic versioning](https://semver.org/) specification.
|
|
139
|
+
* Note, this value is limited to 32 characters by the API.
|
|
140
|
+
*/
|
|
130
141
|
version: string
|
|
142
|
+
/**
|
|
143
|
+
* The timestamp when this version was published.
|
|
144
|
+
*/
|
|
131
145
|
published: number
|
|
132
146
|
}
|
|
133
147
|
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
DataCatalogSchemaWithVersion,
|
|
13
13
|
DataCatalogScope,
|
|
14
14
|
DataCatalogStatus,
|
|
15
|
+
DataCatalogVersionInfo,
|
|
15
16
|
} from '../models/DataCatalog.js'
|
|
16
17
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
17
18
|
import { DataCatalogKind, DataCatalogVersionKind } from '../models/kinds.js'
|
|
@@ -59,10 +60,11 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
59
60
|
return data
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Lists a simple schema of versions for a given data catalog entry.
|
|
65
|
+
* @param key The key of the Data Catalog entry to list versions for.
|
|
66
|
+
*/
|
|
67
|
+
async listVersions(key: string, request: SdkOptions = {}): Promise<ContextListResult<DataCatalogVersionInfo>> {
|
|
66
68
|
const { token } = request
|
|
67
69
|
const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key))
|
|
68
70
|
const result = await this.sdk.http.get(url.toString(), { token })
|
|
@@ -75,7 +77,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
75
77
|
if (!result.body) {
|
|
76
78
|
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
77
79
|
}
|
|
78
|
-
let data: ContextListResult<
|
|
80
|
+
let data: ContextListResult<DataCatalogVersionInfo>
|
|
79
81
|
try {
|
|
80
82
|
data = JSON.parse(result.body)
|
|
81
83
|
} catch {
|
|
@@ -327,7 +329,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
327
329
|
request: SdkOptions = {}
|
|
328
330
|
): Promise<ContextChangeRecord<DataCatalogVersionSchema>> {
|
|
329
331
|
const { token } = request
|
|
330
|
-
const url = this.sdk.getUrl(RouteBuilder.
|
|
332
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersionDeprecate(key, version))
|
|
331
333
|
const body = JSON.stringify({ reason })
|
|
332
334
|
const result = await this.sdk.http.put(url.toString(), {
|
|
333
335
|
token,
|
|
@@ -363,7 +365,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
363
365
|
request: SdkOptions = {}
|
|
364
366
|
): Promise<ContextChangeRecord<DataCatalogVersionSchema>> {
|
|
365
367
|
const { token } = request
|
|
366
|
-
const url = this.sdk.getUrl(RouteBuilder.
|
|
368
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersionUnpublish(key, version))
|
|
367
369
|
const result = await this.sdk.http.put(url.toString(), { token })
|
|
368
370
|
this.inspectCommonStatusCodes(result)
|
|
369
371
|
const E_PREFIX = 'Unable to unpublish data domain version. '
|