@api-client/core 0.12.9 → 0.12.11
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/browser.d.ts +1 -2
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +0 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/exceptions/exception.d.ts +29 -1
- package/build/src/exceptions/exception.d.ts.map +1 -1
- package/build/src/exceptions/exception.js +37 -1
- package/build/src/exceptions/exception.js.map +1 -1
- package/build/src/index.d.ts +1 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +0 -1
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/lib/User.d.ts.map +1 -1
- package/build/src/mocking/lib/User.js +1 -0
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/models/store/User.d.ts +14 -0
- package/build/src/models/store/User.d.ts.map +1 -1
- package/build/src/models/store/User.js.map +1 -1
- package/build/src/proxy/HttpProjectProxy.d.ts.map +1 -1
- package/build/src/proxy/HttpProjectProxy.js +39 -43
- package/build/src/proxy/HttpProjectProxy.js.map +1 -1
- package/build/src/proxy/RequestProxy.d.ts.map +1 -1
- package/build/src/proxy/RequestProxy.js +11 -11
- package/build/src/proxy/RequestProxy.js.map +1 -1
- package/build/src/runtime/store/DataCatalogSdk.d.ts.map +1 -1
- package/build/src/runtime/store/DataCatalogSdk.js +49 -109
- package/build/src/runtime/store/DataCatalogSdk.js.map +1 -1
- package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
- package/build/src/runtime/store/FilesSdk.js +51 -115
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.d.ts.map +1 -1
- package/build/src/runtime/store/HistorySdk.js +25 -70
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.d.ts +20 -1
- package/build/src/runtime/store/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.js +103 -43
- package/build/src/runtime/store/OrganizationsSdk.js.map +1 -1
- package/build/src/runtime/store/RevisionsSdk.d.ts.map +1 -1
- package/build/src/runtime/store/RevisionsSdk.js +5 -10
- package/build/src/runtime/store/RevisionsSdk.js.map +1 -1
- package/build/src/runtime/store/RouteBuilder.d.ts +8 -0
- package/build/src/runtime/store/RouteBuilder.d.ts.map +1 -1
- package/build/src/runtime/store/RouteBuilder.js +12 -0
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/SdkBase.d.ts +7 -5
- package/build/src/runtime/store/SdkBase.d.ts.map +1 -1
- package/build/src/runtime/store/SdkBase.js +45 -63
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts.map +1 -1
- package/build/src/runtime/store/SharedSdk.js +5 -14
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/TrashSdk.d.ts.map +1 -1
- package/build/src/runtime/store/TrashSdk.js +8 -28
- package/build/src/runtime/store/TrashSdk.js.map +1 -1
- package/build/src/runtime/store/UsersSdk.d.ts +2 -0
- package/build/src/runtime/store/UsersSdk.d.ts.map +1 -1
- package/build/src/runtime/store/UsersSdk.js +18 -11
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/package.json +1 -1
- package/src/exceptions/exception.ts +51 -4
- package/src/mocking/lib/User.ts +1 -0
- package/src/models/store/User.ts +16 -0
- package/src/proxy/HttpProjectProxy.ts +39 -43
- package/src/proxy/RequestProxy.ts +11 -11
- package/src/runtime/store/DataCatalogSdk.ts +49 -109
- package/src/runtime/store/FilesSdk.ts +51 -115
- package/src/runtime/store/HistorySdk.ts +25 -70
- package/src/runtime/store/OrganizationsSdk.ts +109 -44
- package/src/runtime/store/RevisionsSdk.ts +5 -10
- package/src/runtime/store/RouteBuilder.ts +14 -0
- package/src/runtime/store/SdkBase.ts +46 -65
- package/src/runtime/store/SharedSdk.ts +5 -14
- package/src/runtime/store/TrashSdk.ts +8 -28
- package/src/runtime/store/UsersSdk.ts +18 -11
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +42 -40
- package/tests/unit/runtime/proxy/RequestProxy.spec.ts +11 -11
- package/build/src/runtime/store/Errors.d.ts +0 -51
- package/build/src/runtime/store/Errors.d.ts.map +0 -1
- package/build/src/runtime/store/Errors.js +0 -61
- package/build/src/runtime/store/Errors.js.map +0 -1
- package/src/runtime/store/Errors.ts +0 -98
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IProjectRunnerOptions } from '../runtime/node/InteropInterfaces.js'
|
|
2
2
|
import { Kind as HttpProjectKind, HttpProject, IHttpProject } from '../models/HttpProject.js'
|
|
3
|
-
import { ApiError } from '../runtime/store/Errors.js'
|
|
4
3
|
import { StoreSdk } from '../runtime/store/StoreSdkNode.js'
|
|
5
4
|
import { ProjectSerialRunner } from '../runtime/node/ProjectSerialRunner.js'
|
|
6
5
|
import { ProjectParallelRunner } from '../runtime/node/ProjectParallelRunner.js'
|
|
7
6
|
import Proxy, { IProxyResult } from './Proxy.js'
|
|
8
7
|
import { IProjectExecutionLog } from '../models/ProjectExecution.js'
|
|
8
|
+
import { Exception } from '../exceptions/exception.js'
|
|
9
9
|
|
|
10
10
|
interface ProxyInit {
|
|
11
11
|
kind: typeof HttpProjectKind
|
|
@@ -44,52 +44,48 @@ export default class HttpProjectProxy extends Proxy {
|
|
|
44
44
|
|
|
45
45
|
protected async configureStore(init: IHttpProjectStoreProxyInit, token: string, baseUri: string): Promise<void> {
|
|
46
46
|
const { pid, options, organization } = init
|
|
47
|
+
const INVALID_REQUEST = 'Invalid request'
|
|
48
|
+
const code = 'E_INVALID_REQUEST'
|
|
47
49
|
if (!pid) {
|
|
48
|
-
throw new
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
code: 400,
|
|
50
|
+
throw new Exception(INVALID_REQUEST, {
|
|
51
|
+
help: 'The "pid" parameter is required.',
|
|
52
|
+
status: 400,
|
|
53
|
+
code,
|
|
53
54
|
})
|
|
54
55
|
}
|
|
55
56
|
if (!organization) {
|
|
56
|
-
throw new
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
code: 400,
|
|
57
|
+
throw new Exception(INVALID_REQUEST, {
|
|
58
|
+
help: 'The "organization" parameter is required.',
|
|
59
|
+
status: 400,
|
|
60
|
+
code,
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
if (!options) {
|
|
64
|
-
throw new
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
code: 400,
|
|
64
|
+
throw new Exception(INVALID_REQUEST, {
|
|
65
|
+
help: 'The "options" parameter is required.',
|
|
66
|
+
status: 400,
|
|
67
|
+
code,
|
|
69
68
|
})
|
|
70
69
|
}
|
|
71
70
|
if (!token) {
|
|
72
|
-
throw new
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
code: 400,
|
|
71
|
+
throw new Exception(INVALID_REQUEST, {
|
|
72
|
+
help: 'Set the authentication credentials.',
|
|
73
|
+
status: 400,
|
|
74
|
+
code,
|
|
77
75
|
})
|
|
78
76
|
}
|
|
79
77
|
if (!baseUri) {
|
|
80
|
-
throw new
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
code: 400,
|
|
78
|
+
throw new Exception(INVALID_REQUEST, {
|
|
79
|
+
help: 'The store uri is missing.',
|
|
80
|
+
status: 400,
|
|
81
|
+
code,
|
|
85
82
|
})
|
|
86
83
|
}
|
|
87
84
|
if (!baseUri.startsWith('http')) {
|
|
88
|
-
throw new
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
code: 400,
|
|
85
|
+
throw new Exception(INVALID_REQUEST, {
|
|
86
|
+
help: 'The store uri is invalid.',
|
|
87
|
+
status: 400,
|
|
88
|
+
code,
|
|
93
89
|
})
|
|
94
90
|
}
|
|
95
91
|
const sdk = new StoreSdk(baseUri)
|
|
@@ -100,10 +96,10 @@ export default class HttpProjectProxy extends Proxy {
|
|
|
100
96
|
project = data.media as IHttpProject
|
|
101
97
|
} catch (cause) {
|
|
102
98
|
const e = cause as Error
|
|
103
|
-
throw new
|
|
99
|
+
throw new Exception(e.message, { status: 400 })
|
|
104
100
|
}
|
|
105
101
|
if (project.key !== pid) {
|
|
106
|
-
throw new
|
|
102
|
+
throw new Exception(`Unable to read the project.`, { status: 500 })
|
|
107
103
|
}
|
|
108
104
|
this.options = options
|
|
109
105
|
this.project = new HttpProject(project)
|
|
@@ -111,20 +107,20 @@ export default class HttpProjectProxy extends Proxy {
|
|
|
111
107
|
|
|
112
108
|
protected async configureProject(init: IHttpProjectProxyInit): Promise<void> {
|
|
113
109
|
const { project, options } = init
|
|
110
|
+
const INVALID_REQUEST = 'Invalid request'
|
|
111
|
+
const code = 'E_INVALID_REQUEST'
|
|
114
112
|
if (!options) {
|
|
115
|
-
throw new
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
code: 400,
|
|
113
|
+
throw new Exception(INVALID_REQUEST, {
|
|
114
|
+
help: 'The "options" parameter is required.',
|
|
115
|
+
status: 400,
|
|
116
|
+
code,
|
|
120
117
|
})
|
|
121
118
|
}
|
|
122
119
|
if (!project) {
|
|
123
|
-
throw new
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
code: 400,
|
|
120
|
+
throw new Exception(INVALID_REQUEST, {
|
|
121
|
+
help: 'The "project" parameter is required.',
|
|
122
|
+
status: 400,
|
|
123
|
+
code,
|
|
128
124
|
})
|
|
129
125
|
}
|
|
130
126
|
this.options = options
|
|
@@ -3,12 +3,12 @@ import { IRequestAuthorization } from '../models/RequestAuthorization.js'
|
|
|
3
3
|
import { IRequestConfig } from '../models/RequestConfig.js'
|
|
4
4
|
import Proxy, { IProxyResult } from './Proxy.js'
|
|
5
5
|
import { HttpCertificate } from '../models/ClientCertificate.js'
|
|
6
|
-
import { ApiError } from '../runtime/store/Errors.js'
|
|
7
6
|
import { DummyLogger } from '../lib/logging/DummyLogger.js'
|
|
8
7
|
import { HttpRequestRunner } from '../runtime/http-runner/HttpRequestRunner.js'
|
|
9
8
|
import { IRequestLog } from '../models/RequestLog.js'
|
|
10
9
|
import { IHttpFlow } from '../models/http-flows/HttpFlows.js'
|
|
11
10
|
import { IHttpAssertion } from '../models/http-flows/HttpAssertion.js'
|
|
11
|
+
import { Exception } from '../exceptions/exception.js'
|
|
12
12
|
|
|
13
13
|
export interface IRequestProxyInit {
|
|
14
14
|
kind: typeof HttpRequestKind
|
|
@@ -54,20 +54,20 @@ export default class RequestProxy extends Proxy {
|
|
|
54
54
|
|
|
55
55
|
async configure(init: IRequestProxyInit): Promise<void> {
|
|
56
56
|
const { request } = init
|
|
57
|
+
const INVALID_REQUEST = 'Invalid request'
|
|
58
|
+
const code = 'E_INVALID_REQUEST'
|
|
57
59
|
if (!request) {
|
|
58
|
-
throw new
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
code: 400,
|
|
60
|
+
throw new Exception(INVALID_REQUEST, {
|
|
61
|
+
help: 'The "request" parameter is required.',
|
|
62
|
+
status: 400,
|
|
63
|
+
code,
|
|
63
64
|
})
|
|
64
65
|
}
|
|
65
66
|
if (!request.url) {
|
|
66
|
-
throw new
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
code: 400,
|
|
67
|
+
throw new Exception(INVALID_REQUEST, {
|
|
68
|
+
help: 'The "request.url" parameter is required.',
|
|
69
|
+
status: 400,
|
|
70
|
+
code,
|
|
71
71
|
})
|
|
72
72
|
}
|
|
73
73
|
this.init = init
|
|
@@ -14,11 +14,11 @@ import type {
|
|
|
14
14
|
DataCatalogStatus,
|
|
15
15
|
} from '../../models/DataCatalog.js'
|
|
16
16
|
import { RouteBuilder } from './RouteBuilder.js'
|
|
17
|
-
import { SdkError } from './Errors.js'
|
|
18
17
|
import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js'
|
|
19
18
|
import type { DataCatalogVersionSchema } from '../../models/DataCatalogVersion.js'
|
|
20
19
|
import type { ForeignDomainDependency } from '../../modeling/types.js'
|
|
21
20
|
import type { DataDomainSchema } from '../../modeling/DataDomain.js'
|
|
21
|
+
import { Exception } from '../../exceptions/exception.js'
|
|
22
22
|
|
|
23
23
|
export interface DataCatalogListOptions extends ContextListOptions {
|
|
24
24
|
scope?: DataCatalogScope
|
|
@@ -41,25 +41,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
41
41
|
const E_PREFIX = 'Unable to list data domains. '
|
|
42
42
|
if (result.status !== 200) {
|
|
43
43
|
this.logInvalidResponse(result)
|
|
44
|
-
|
|
45
|
-
if (!e) {
|
|
46
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
47
|
-
e.response = result.body
|
|
48
|
-
}
|
|
49
|
-
throw e
|
|
44
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
50
45
|
}
|
|
51
46
|
if (!result.body) {
|
|
52
|
-
throw new
|
|
47
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
let data: ContextListResult<DataCatalogSchemaWithVersion>
|
|
56
51
|
try {
|
|
57
52
|
data = JSON.parse(result.body)
|
|
58
53
|
} catch {
|
|
59
|
-
throw new
|
|
54
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
60
55
|
}
|
|
61
56
|
if (!Array.isArray(data.items)) {
|
|
62
|
-
throw new
|
|
57
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
63
58
|
}
|
|
64
59
|
return data
|
|
65
60
|
}
|
|
@@ -75,24 +70,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
75
70
|
const E_PREFIX = 'Unable to list data domain versions. '
|
|
76
71
|
if (result.status !== 200) {
|
|
77
72
|
this.logInvalidResponse(result)
|
|
78
|
-
|
|
79
|
-
if (!e) {
|
|
80
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
81
|
-
e.response = result.body
|
|
82
|
-
}
|
|
83
|
-
throw e
|
|
73
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
84
74
|
}
|
|
85
75
|
if (!result.body) {
|
|
86
|
-
throw new
|
|
76
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
87
77
|
}
|
|
88
78
|
let data: ContextListResult<{ key: string; version: string; published: number }>
|
|
89
79
|
try {
|
|
90
80
|
data = JSON.parse(result.body)
|
|
91
81
|
} catch {
|
|
92
|
-
throw new
|
|
82
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
93
83
|
}
|
|
94
84
|
if (!Array.isArray(data.items)) {
|
|
95
|
-
throw new
|
|
85
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
96
86
|
}
|
|
97
87
|
return data
|
|
98
88
|
}
|
|
@@ -118,25 +108,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
118
108
|
const E_PREFIX = 'Unable to publish data domain. '
|
|
119
109
|
if (result.status !== 200) {
|
|
120
110
|
this.logInvalidResponse(result)
|
|
121
|
-
|
|
122
|
-
if (!e) {
|
|
123
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
124
|
-
e.response = result.body
|
|
125
|
-
}
|
|
126
|
-
throw e
|
|
111
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
127
112
|
}
|
|
128
113
|
|
|
129
114
|
if (!result.body) {
|
|
130
|
-
throw new
|
|
115
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
131
116
|
}
|
|
132
117
|
let data: ContextChangeRecord<DataCatalogSchema>
|
|
133
118
|
try {
|
|
134
119
|
data = JSON.parse(result.body)
|
|
135
120
|
} catch {
|
|
136
|
-
throw new
|
|
121
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
137
122
|
}
|
|
138
123
|
if (!data.key) {
|
|
139
|
-
throw new
|
|
124
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
140
125
|
}
|
|
141
126
|
return data
|
|
142
127
|
}
|
|
@@ -149,24 +134,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
149
134
|
const E_PREFIX = 'Unable to read data domain. '
|
|
150
135
|
if (result.status !== 200) {
|
|
151
136
|
this.logInvalidResponse(result)
|
|
152
|
-
|
|
153
|
-
if (!e) {
|
|
154
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
155
|
-
e.response = result.body
|
|
156
|
-
}
|
|
157
|
-
throw e
|
|
137
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
158
138
|
}
|
|
159
139
|
if (!result.body) {
|
|
160
|
-
throw new
|
|
140
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
161
141
|
}
|
|
162
142
|
let data: DataCatalogSchema
|
|
163
143
|
try {
|
|
164
144
|
data = JSON.parse(result.body)
|
|
165
145
|
} catch {
|
|
166
|
-
throw new
|
|
146
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
167
147
|
}
|
|
168
148
|
if (data.kind !== DataCatalogKind) {
|
|
169
|
-
throw new
|
|
149
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
170
150
|
}
|
|
171
151
|
return data
|
|
172
152
|
}
|
|
@@ -196,24 +176,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
196
176
|
const E_PREFIX = 'Unable to deprecate data domain. '
|
|
197
177
|
if (result.status !== 200) {
|
|
198
178
|
this.logInvalidResponse(result)
|
|
199
|
-
|
|
200
|
-
if (!e) {
|
|
201
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
202
|
-
e.response = result.body
|
|
203
|
-
}
|
|
204
|
-
throw e
|
|
179
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
205
180
|
}
|
|
206
181
|
if (!result.body) {
|
|
207
|
-
throw new
|
|
182
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
208
183
|
}
|
|
209
184
|
let data: ContextChangeRecord<DataCatalogSchema>
|
|
210
185
|
try {
|
|
211
186
|
data = JSON.parse(result.body)
|
|
212
187
|
} catch {
|
|
213
|
-
throw new
|
|
188
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
214
189
|
}
|
|
215
190
|
if (data.kind !== DataCatalogKind) {
|
|
216
|
-
throw new
|
|
191
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
217
192
|
}
|
|
218
193
|
return data
|
|
219
194
|
}
|
|
@@ -232,24 +207,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
232
207
|
const E_PREFIX = 'Unable to unpublish data domain. '
|
|
233
208
|
if (result.status !== 200) {
|
|
234
209
|
this.logInvalidResponse(result)
|
|
235
|
-
|
|
236
|
-
if (!e) {
|
|
237
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
238
|
-
e.response = result.body
|
|
239
|
-
}
|
|
240
|
-
throw e
|
|
210
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
241
211
|
}
|
|
242
212
|
if (!result.body) {
|
|
243
|
-
throw new
|
|
213
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
244
214
|
}
|
|
245
215
|
let data: ContextChangeRecord<DataCatalogSchema>
|
|
246
216
|
try {
|
|
247
217
|
data = JSON.parse(result.body)
|
|
248
218
|
} catch {
|
|
249
|
-
throw new
|
|
219
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
250
220
|
}
|
|
251
221
|
if (data.kind !== DataCatalogKind) {
|
|
252
|
-
throw new
|
|
222
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
253
223
|
}
|
|
254
224
|
return data
|
|
255
225
|
}
|
|
@@ -273,24 +243,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
273
243
|
const E_PREFIX = 'Unable to publish data domain version. '
|
|
274
244
|
if (result.status !== 200) {
|
|
275
245
|
this.logInvalidResponse(result)
|
|
276
|
-
|
|
277
|
-
if (!e) {
|
|
278
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
279
|
-
e.response = result.body
|
|
280
|
-
}
|
|
281
|
-
throw e
|
|
246
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
282
247
|
}
|
|
283
248
|
if (!result.body) {
|
|
284
|
-
throw new
|
|
249
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
285
250
|
}
|
|
286
251
|
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
287
252
|
try {
|
|
288
253
|
data = JSON.parse(result.body)
|
|
289
254
|
} catch {
|
|
290
|
-
throw new
|
|
255
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
291
256
|
}
|
|
292
257
|
if (data.kind !== DataCatalogVersionKind) {
|
|
293
|
-
throw new
|
|
258
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
294
259
|
}
|
|
295
260
|
return data
|
|
296
261
|
}
|
|
@@ -303,24 +268,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
303
268
|
const E_PREFIX = 'Unable to read data domain version. '
|
|
304
269
|
if (result.status !== 200) {
|
|
305
270
|
this.logInvalidResponse(result)
|
|
306
|
-
|
|
307
|
-
if (!e) {
|
|
308
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
309
|
-
e.response = result.body
|
|
310
|
-
}
|
|
311
|
-
throw e
|
|
271
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
312
272
|
}
|
|
313
273
|
if (!result.body) {
|
|
314
|
-
throw new
|
|
274
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
315
275
|
}
|
|
316
276
|
let data: DataCatalogVersionSchema
|
|
317
277
|
try {
|
|
318
278
|
data = JSON.parse(result.body)
|
|
319
279
|
} catch {
|
|
320
|
-
throw new
|
|
280
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
321
281
|
}
|
|
322
282
|
if (data.kind !== DataCatalogVersionKind) {
|
|
323
|
-
throw new
|
|
283
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
324
284
|
}
|
|
325
285
|
return data
|
|
326
286
|
}
|
|
@@ -343,24 +303,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
343
303
|
const E_PREFIX = 'Unable to list data domain dependencies. '
|
|
344
304
|
if (result.status !== 200) {
|
|
345
305
|
this.logInvalidResponse(result)
|
|
346
|
-
|
|
347
|
-
if (!e) {
|
|
348
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
349
|
-
e.response = result.body
|
|
350
|
-
}
|
|
351
|
-
throw e
|
|
306
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
352
307
|
}
|
|
353
308
|
if (!result.body) {
|
|
354
|
-
throw new
|
|
309
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
355
310
|
}
|
|
356
311
|
let data: ContextListResult<DataDomainSchema[]>
|
|
357
312
|
try {
|
|
358
313
|
data = JSON.parse(result.body)
|
|
359
314
|
} catch {
|
|
360
|
-
throw new
|
|
315
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
361
316
|
}
|
|
362
317
|
if (!Array.isArray(data.items)) {
|
|
363
|
-
throw new
|
|
318
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
364
319
|
}
|
|
365
320
|
return data
|
|
366
321
|
}
|
|
@@ -385,24 +340,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
385
340
|
const E_PREFIX = 'Unable to deprecate data domain version. '
|
|
386
341
|
if (result.status !== 200) {
|
|
387
342
|
this.logInvalidResponse(result)
|
|
388
|
-
|
|
389
|
-
if (!e) {
|
|
390
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
391
|
-
e.response = result.body
|
|
392
|
-
}
|
|
393
|
-
throw e
|
|
343
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
394
344
|
}
|
|
395
345
|
if (!result.body) {
|
|
396
|
-
throw new
|
|
346
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
397
347
|
}
|
|
398
348
|
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
399
349
|
try {
|
|
400
350
|
data = JSON.parse(result.body)
|
|
401
351
|
} catch {
|
|
402
|
-
throw new
|
|
352
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
403
353
|
}
|
|
404
354
|
if (data.kind !== DataCatalogVersionKind) {
|
|
405
|
-
throw new
|
|
355
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
406
356
|
}
|
|
407
357
|
return data
|
|
408
358
|
}
|
|
@@ -419,24 +369,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
419
369
|
const E_PREFIX = 'Unable to unpublish data domain version. '
|
|
420
370
|
if (result.status !== 200) {
|
|
421
371
|
this.logInvalidResponse(result)
|
|
422
|
-
|
|
423
|
-
if (!e) {
|
|
424
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
425
|
-
e.response = result.body
|
|
426
|
-
}
|
|
427
|
-
throw e
|
|
372
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
428
373
|
}
|
|
429
374
|
if (!result.body) {
|
|
430
|
-
throw new
|
|
375
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
431
376
|
}
|
|
432
377
|
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
433
378
|
try {
|
|
434
379
|
data = JSON.parse(result.body)
|
|
435
380
|
} catch {
|
|
436
|
-
throw new
|
|
381
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
437
382
|
}
|
|
438
383
|
if (data.kind !== DataCatalogVersionKind) {
|
|
439
|
-
throw new
|
|
384
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
440
385
|
}
|
|
441
386
|
return data
|
|
442
387
|
}
|
|
@@ -449,24 +394,19 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
449
394
|
const E_PREFIX = 'Unable to check data domain publication status. '
|
|
450
395
|
if (result.status !== 200) {
|
|
451
396
|
this.logInvalidResponse(result)
|
|
452
|
-
|
|
453
|
-
if (!e) {
|
|
454
|
-
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status)
|
|
455
|
-
e.response = result.body
|
|
456
|
-
}
|
|
457
|
-
throw e
|
|
397
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
458
398
|
}
|
|
459
399
|
if (!result.body) {
|
|
460
|
-
throw new
|
|
400
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
461
401
|
}
|
|
462
402
|
let data: DataCatalogStatus
|
|
463
403
|
try {
|
|
464
404
|
data = JSON.parse(result.body)
|
|
465
405
|
} catch {
|
|
466
|
-
throw new
|
|
406
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
467
407
|
}
|
|
468
408
|
if (data.kind !== DataCatalogKind) {
|
|
469
|
-
throw new
|
|
409
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
470
410
|
}
|
|
471
411
|
return data
|
|
472
412
|
}
|