@api-client/core 0.19.23 → 0.19.25
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 +3 -0
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +2 -0
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +5 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +4 -0
- package/build/src/index.js.map +1 -1
- 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/Deployment.d.ts +16 -0
- package/build/src/mocking/lib/Deployment.d.ts.map +1 -0
- package/build/src/mocking/lib/Deployment.js +76 -0
- package/build/src/mocking/lib/Deployment.js.map +1 -0
- package/build/src/modeling/Bindings.d.ts +4 -0
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DataFormat.d.ts +1 -1
- package/build/src/modeling/DataFormat.d.ts.map +1 -1
- package/build/src/modeling/DataFormat.js +2 -0
- package/build/src/modeling/DataFormat.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +7 -0
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js +10 -0
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainEntity.d.ts +9 -1
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js +26 -1
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts +12 -1
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +24 -1
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/RuntimeApiModel.d.ts +52 -0
- package/build/src/modeling/RuntimeApiModel.d.ts.map +1 -0
- package/build/src/modeling/RuntimeApiModel.js +85 -0
- package/build/src/modeling/RuntimeApiModel.js.map +1 -0
- package/build/src/modeling/actions/index.d.ts +10 -0
- package/build/src/modeling/actions/index.d.ts.map +1 -1
- package/build/src/modeling/actions/index.js +30 -0
- package/build/src/modeling/actions/index.js.map +1 -1
- package/build/src/modeling/index.d.ts.map +1 -1
- package/build/src/modeling/index.js +1 -0
- package/build/src/modeling/index.js.map +1 -1
- package/build/src/modeling/types.d.ts +25 -1
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/models/kinds.d.ts +1 -0
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +1 -0
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/models/store/CustomDomain.d.ts +50 -0
- package/build/src/models/store/CustomDomain.d.ts.map +1 -0
- package/build/src/models/store/CustomDomain.js +79 -0
- package/build/src/models/store/CustomDomain.js.map +1 -0
- package/build/src/models/store/Deployment.d.ts +118 -0
- package/build/src/models/store/Deployment.d.ts.map +1 -0
- package/build/src/models/store/Deployment.js +182 -0
- package/build/src/models/store/Deployment.js.map +1 -0
- package/build/src/models/store/DeploymentCustomDomain.d.ts +52 -0
- package/build/src/models/store/DeploymentCustomDomain.d.ts.map +1 -0
- package/build/src/models/store/DeploymentCustomDomain.js +84 -0
- package/build/src/models/store/DeploymentCustomDomain.js.map +1 -0
- package/build/src/sdk/DataCatalogSdk.d.ts.map +1 -1
- package/build/src/sdk/DataCatalogSdk.js +22 -179
- package/build/src/sdk/DataCatalogSdk.js.map +1 -1
- package/build/src/sdk/DeploymentsSdk.d.ts +48 -0
- package/build/src/sdk/DeploymentsSdk.d.ts.map +1 -0
- package/build/src/sdk/DeploymentsSdk.js +94 -0
- package/build/src/sdk/DeploymentsSdk.js.map +1 -0
- package/build/src/sdk/RouteBuilder.d.ts +2 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +6 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/src/sdk/Sdk.d.ts +2 -0
- package/build/src/sdk/Sdk.d.ts.map +1 -1
- package/build/src/sdk/Sdk.js +2 -0
- package/build/src/sdk/Sdk.js.map +1 -1
- package/build/src/sdk/SdkBase.d.ts +19 -1
- package/build/src/sdk/SdkBase.d.ts.map +1 -1
- package/build/src/sdk/SdkBase.js +31 -1
- package/build/src/sdk/SdkBase.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +9 -0
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +73 -0
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/matchit.d.ts +19 -0
- package/src/mocking/ModelingMock.ts +2 -0
- package/src/mocking/lib/Deployment.ts +88 -0
- package/src/modeling/Bindings.ts +4 -0
- package/src/modeling/DataFormat.ts +4 -0
- package/src/modeling/DomainAssociation.ts +11 -0
- package/src/modeling/DomainEntity.ts +30 -1
- package/src/modeling/ExposedEntity.ts +26 -1
- package/src/modeling/RuntimeApiModel.ts +137 -0
- package/src/modeling/types.ts +26 -1
- package/src/models/kinds.ts +1 -0
- package/src/models/store/CustomDomain.ts +119 -0
- package/src/models/store/Deployment.ts +250 -0
- package/src/models/store/DeploymentCustomDomain.ts +120 -0
- package/src/sdk/DataCatalogSdk.ts +22 -176
- package/src/sdk/DeploymentsSdk.ts +123 -0
- package/src/sdk/RouteBuilder.ts +8 -0
- package/src/sdk/Sdk.ts +3 -0
- package/src/sdk/SdkBase.ts +35 -3
- package/src/sdk/SdkMock.ts +103 -0
- package/tests/unit/modeling/RuntimeApiModel.spec.ts +122 -0
- package/tests/unit/modeling/actions/index.spec.ts +113 -0
- package/tests/unit/modeling/domain_asociation.spec.ts +28 -0
- package/tests/unit/modeling/domain_entity_parents.spec.ts +49 -0
- package/tests/unit/modeling/exposed_entity_actions.spec.ts +47 -0
- package/tests/unit/models/store/CustomDomain.spec.ts +111 -0
- package/tests/unit/models/store/Deployment.spec.ts +198 -0
- package/tests/unit/models/store/DeploymentCustomDomain.spec.ts +122 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import type { FieldValidationMessage } from '../../exceptions/validation_error.js'
|
|
2
|
+
import { nanoid } from '../../nanoid.js'
|
|
3
|
+
import { DeploymentKind } from '../kinds.js'
|
|
4
|
+
|
|
5
|
+
export { DeploymentKind }
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Status of the deployment
|
|
9
|
+
*/
|
|
10
|
+
export enum DeploymentStatus {
|
|
11
|
+
/**
|
|
12
|
+
* Deployment is pending
|
|
13
|
+
*/
|
|
14
|
+
Pending = 0,
|
|
15
|
+
/**
|
|
16
|
+
* Deployment is active
|
|
17
|
+
*/
|
|
18
|
+
Active = 1,
|
|
19
|
+
/**
|
|
20
|
+
* Deployment is inactive
|
|
21
|
+
*/
|
|
22
|
+
Inactive = 2,
|
|
23
|
+
/**
|
|
24
|
+
* Deployment has failed
|
|
25
|
+
*/
|
|
26
|
+
Failed = 3,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Environment tag for logical deployment grouping
|
|
31
|
+
*/
|
|
32
|
+
export enum DeploymentEnvironment {
|
|
33
|
+
PROD = 'prod',
|
|
34
|
+
STAGING = 'staging',
|
|
35
|
+
DEV = 'dev',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DeploymentSchema {
|
|
39
|
+
kind: typeof DeploymentKind
|
|
40
|
+
/**
|
|
41
|
+
* Primary key (nanoid)
|
|
42
|
+
*/
|
|
43
|
+
key: string
|
|
44
|
+
/**
|
|
45
|
+
* ID of the organization
|
|
46
|
+
*/
|
|
47
|
+
orgId: string
|
|
48
|
+
/**
|
|
49
|
+
* The file ID representing the API
|
|
50
|
+
*/
|
|
51
|
+
apiId: string
|
|
52
|
+
/**
|
|
53
|
+
* Denormalized organization slug
|
|
54
|
+
*/
|
|
55
|
+
orgSlug: string
|
|
56
|
+
/**
|
|
57
|
+
* Denormalized API slug
|
|
58
|
+
*/
|
|
59
|
+
apiSlug: string
|
|
60
|
+
/**
|
|
61
|
+
* Environment tag
|
|
62
|
+
*/
|
|
63
|
+
env: DeploymentEnvironment
|
|
64
|
+
/**
|
|
65
|
+
* The version of the deployment (e.g., 'v1', 'v2')
|
|
66
|
+
* It must be set for production environments.
|
|
67
|
+
* It cannot be set for non-production environments (e.g. 'dev').
|
|
68
|
+
*/
|
|
69
|
+
version?: string
|
|
70
|
+
/**
|
|
71
|
+
* The semantic version of the deployed API model (e.g., '1.0.1').
|
|
72
|
+
*/
|
|
73
|
+
modelVersion: string
|
|
74
|
+
/**
|
|
75
|
+
* Status of the deployment
|
|
76
|
+
*/
|
|
77
|
+
status: DeploymentStatus
|
|
78
|
+
/**
|
|
79
|
+
* Timestamp of creation
|
|
80
|
+
*/
|
|
81
|
+
createdAt: number
|
|
82
|
+
/**
|
|
83
|
+
* Timestamp of last update
|
|
84
|
+
*/
|
|
85
|
+
updatedAt: number
|
|
86
|
+
/**
|
|
87
|
+
* The base URI to the API.
|
|
88
|
+
* Note: This field is computed at runtime when the deployment status is active.
|
|
89
|
+
* Note: This field is ignored when creating or updating a deployment.
|
|
90
|
+
*/
|
|
91
|
+
baseUri?: string
|
|
92
|
+
/**
|
|
93
|
+
* The URI to the API portal.
|
|
94
|
+
* Note: This field is computed at runtime when the deployment status is active.
|
|
95
|
+
* Note: This field is ignored when creating or updating a deployment.
|
|
96
|
+
*/
|
|
97
|
+
portalUri?: string
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export class Deployment implements DeploymentSchema {
|
|
101
|
+
readonly kind: typeof DeploymentKind = DeploymentKind
|
|
102
|
+
key: string
|
|
103
|
+
orgId: string
|
|
104
|
+
apiId: string
|
|
105
|
+
orgSlug: string
|
|
106
|
+
apiSlug: string
|
|
107
|
+
env: DeploymentEnvironment
|
|
108
|
+
version?: string
|
|
109
|
+
modelVersion: string
|
|
110
|
+
status: DeploymentStatus
|
|
111
|
+
createdAt: number
|
|
112
|
+
updatedAt: number
|
|
113
|
+
baseUri?: string
|
|
114
|
+
portalUri?: string
|
|
115
|
+
|
|
116
|
+
static createSchema(input: Partial<DeploymentSchema> = {}): DeploymentSchema {
|
|
117
|
+
const key = input.key ?? nanoid()
|
|
118
|
+
const result: DeploymentSchema = {
|
|
119
|
+
kind: DeploymentKind,
|
|
120
|
+
key,
|
|
121
|
+
orgId: input.orgId || '',
|
|
122
|
+
apiId: input.apiId || '',
|
|
123
|
+
orgSlug: input.orgSlug || '',
|
|
124
|
+
apiSlug: input.apiSlug || '',
|
|
125
|
+
env: input.env ?? DeploymentEnvironment.DEV,
|
|
126
|
+
modelVersion: input.modelVersion || '0.0.0',
|
|
127
|
+
status: input.status ?? DeploymentStatus.Pending,
|
|
128
|
+
createdAt: input.createdAt ?? Date.now(),
|
|
129
|
+
updatedAt: input.updatedAt ?? Date.now(),
|
|
130
|
+
}
|
|
131
|
+
if (input.baseUri) {
|
|
132
|
+
result.baseUri = input.baseUri
|
|
133
|
+
}
|
|
134
|
+
if (input.portalUri) {
|
|
135
|
+
result.portalUri = input.portalUri
|
|
136
|
+
}
|
|
137
|
+
if (input.version) {
|
|
138
|
+
result.version = input.version
|
|
139
|
+
}
|
|
140
|
+
return result
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
constructor(state?: Partial<DeploymentSchema>) {
|
|
144
|
+
const init = Deployment.createSchema(state)
|
|
145
|
+
this.key = init.key
|
|
146
|
+
this.orgId = init.orgId
|
|
147
|
+
this.apiId = init.apiId
|
|
148
|
+
this.orgSlug = init.orgSlug
|
|
149
|
+
this.apiSlug = init.apiSlug
|
|
150
|
+
this.env = init.env
|
|
151
|
+
this.version = init.version
|
|
152
|
+
this.status = init.status
|
|
153
|
+
this.createdAt = init.createdAt
|
|
154
|
+
this.updatedAt = init.updatedAt
|
|
155
|
+
this.modelVersion = init.modelVersion
|
|
156
|
+
this.baseUri = init.baseUri
|
|
157
|
+
this.portalUri = init.portalUri
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
toJSON(): DeploymentSchema {
|
|
161
|
+
const result: DeploymentSchema = {
|
|
162
|
+
kind: DeploymentKind,
|
|
163
|
+
key: this.key,
|
|
164
|
+
orgId: this.orgId,
|
|
165
|
+
apiId: this.apiId,
|
|
166
|
+
orgSlug: this.orgSlug,
|
|
167
|
+
apiSlug: this.apiSlug,
|
|
168
|
+
env: this.env,
|
|
169
|
+
modelVersion: this.modelVersion,
|
|
170
|
+
status: this.status,
|
|
171
|
+
createdAt: this.createdAt,
|
|
172
|
+
updatedAt: this.updatedAt,
|
|
173
|
+
}
|
|
174
|
+
if (this.version) {
|
|
175
|
+
result.version = this.version
|
|
176
|
+
}
|
|
177
|
+
if (this.baseUri) {
|
|
178
|
+
result.baseUri = this.baseUri
|
|
179
|
+
}
|
|
180
|
+
if (this.portalUri) {
|
|
181
|
+
result.portalUri = this.portalUri
|
|
182
|
+
}
|
|
183
|
+
return result
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Validates the deployment.
|
|
188
|
+
* @returns An array of validation messages.
|
|
189
|
+
*/
|
|
190
|
+
validate(): FieldValidationMessage[] {
|
|
191
|
+
const result: FieldValidationMessage[] = []
|
|
192
|
+
|
|
193
|
+
if (this.orgId === '') {
|
|
194
|
+
result.push({
|
|
195
|
+
field: 'orgId',
|
|
196
|
+
message: 'Org ID must not be empty',
|
|
197
|
+
rule: 'notEmpty',
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
if (this.apiId === '') {
|
|
201
|
+
result.push({
|
|
202
|
+
field: 'apiId',
|
|
203
|
+
message: 'API ID must not be empty',
|
|
204
|
+
rule: 'notEmpty',
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
if (this.orgSlug === '') {
|
|
208
|
+
result.push({
|
|
209
|
+
field: 'orgSlug',
|
|
210
|
+
message: 'Org slug must not be empty',
|
|
211
|
+
rule: 'notEmpty',
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
if (this.apiSlug === '') {
|
|
215
|
+
result.push({
|
|
216
|
+
field: 'apiSlug',
|
|
217
|
+
message: 'API slug must not be empty',
|
|
218
|
+
rule: 'notEmpty',
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
if (!this.env) {
|
|
222
|
+
result.push({
|
|
223
|
+
field: 'env',
|
|
224
|
+
message: 'Environment tag must not be empty',
|
|
225
|
+
rule: 'notEmpty',
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
if (this.modelVersion === '') {
|
|
229
|
+
result.push({
|
|
230
|
+
field: 'modelVersion',
|
|
231
|
+
message: 'API model version must not be empty',
|
|
232
|
+
rule: 'notEmpty',
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
if (this.env === DeploymentEnvironment.PROD && !this.version) {
|
|
236
|
+
result.push({
|
|
237
|
+
field: 'version',
|
|
238
|
+
message: 'Version must not be empty for production environment',
|
|
239
|
+
rule: 'notEmpty',
|
|
240
|
+
})
|
|
241
|
+
} else if (this.env !== DeploymentEnvironment.PROD && this.version) {
|
|
242
|
+
result.push({
|
|
243
|
+
field: 'version',
|
|
244
|
+
message: 'Version must not be present for non-production environment',
|
|
245
|
+
rule: 'notEmpty',
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
return result
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { FieldValidationMessage } from '../../exceptions/validation_error.js'
|
|
2
|
+
import { nanoid } from '../../nanoid.js'
|
|
3
|
+
|
|
4
|
+
export enum SslStatus {
|
|
5
|
+
Initializing = 0,
|
|
6
|
+
PendingDns = 1,
|
|
7
|
+
Issuing = 2,
|
|
8
|
+
Active = 3,
|
|
9
|
+
Error = 4,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DeploymentCustomDomainSchema {
|
|
13
|
+
/**
|
|
14
|
+
* Primary key (nanoid)
|
|
15
|
+
*/
|
|
16
|
+
id: string
|
|
17
|
+
/**
|
|
18
|
+
* ID of the deployment
|
|
19
|
+
*/
|
|
20
|
+
deploymentId: string
|
|
21
|
+
/**
|
|
22
|
+
* ID of the custom domain
|
|
23
|
+
*/
|
|
24
|
+
customDomainId: string
|
|
25
|
+
/**
|
|
26
|
+
* The base path for the deployment
|
|
27
|
+
*/
|
|
28
|
+
basePath: string
|
|
29
|
+
/**
|
|
30
|
+
* Status of the SSL certificate
|
|
31
|
+
*/
|
|
32
|
+
sslStatus: SslStatus
|
|
33
|
+
/**
|
|
34
|
+
* Timestamp of creation
|
|
35
|
+
*/
|
|
36
|
+
createdAt: number
|
|
37
|
+
/**
|
|
38
|
+
* Timestamp of last update
|
|
39
|
+
*/
|
|
40
|
+
updatedAt: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class DeploymentCustomDomainModel implements DeploymentCustomDomainSchema {
|
|
44
|
+
id: string
|
|
45
|
+
deploymentId: string
|
|
46
|
+
customDomainId: string
|
|
47
|
+
basePath: string
|
|
48
|
+
sslStatus: SslStatus
|
|
49
|
+
createdAt: number
|
|
50
|
+
updatedAt: number
|
|
51
|
+
|
|
52
|
+
static createSchema(input: Partial<DeploymentCustomDomainSchema> = {}): DeploymentCustomDomainSchema {
|
|
53
|
+
const id = input.id ?? nanoid()
|
|
54
|
+
return {
|
|
55
|
+
id,
|
|
56
|
+
deploymentId: input.deploymentId || '',
|
|
57
|
+
customDomainId: input.customDomainId || '',
|
|
58
|
+
basePath: input.basePath ?? '/',
|
|
59
|
+
sslStatus: input.sslStatus ?? SslStatus.PendingDns,
|
|
60
|
+
createdAt: input.createdAt ?? Date.now(),
|
|
61
|
+
updatedAt: input.updatedAt ?? Date.now(),
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
constructor(state?: Partial<DeploymentCustomDomainSchema>) {
|
|
66
|
+
const init = DeploymentCustomDomainModel.createSchema(state)
|
|
67
|
+
this.id = init.id
|
|
68
|
+
this.deploymentId = init.deploymentId
|
|
69
|
+
this.customDomainId = init.customDomainId
|
|
70
|
+
this.basePath = init.basePath
|
|
71
|
+
this.sslStatus = init.sslStatus
|
|
72
|
+
this.createdAt = init.createdAt
|
|
73
|
+
this.updatedAt = init.updatedAt
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
toJSON(): DeploymentCustomDomainSchema {
|
|
77
|
+
return {
|
|
78
|
+
id: this.id,
|
|
79
|
+
deploymentId: this.deploymentId,
|
|
80
|
+
customDomainId: this.customDomainId,
|
|
81
|
+
basePath: this.basePath,
|
|
82
|
+
sslStatus: this.sslStatus,
|
|
83
|
+
createdAt: this.createdAt,
|
|
84
|
+
updatedAt: this.updatedAt,
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
validate(): FieldValidationMessage[] {
|
|
89
|
+
const result: FieldValidationMessage[] = []
|
|
90
|
+
|
|
91
|
+
if (this.basePath === '') {
|
|
92
|
+
result.push({
|
|
93
|
+
field: 'basePath',
|
|
94
|
+
message: 'Base path must not be empty',
|
|
95
|
+
rule: 'notEmpty',
|
|
96
|
+
})
|
|
97
|
+
} else if (!this.basePath.startsWith('/')) {
|
|
98
|
+
result.push({
|
|
99
|
+
field: 'basePath',
|
|
100
|
+
message: 'Base path must start with a slash',
|
|
101
|
+
rule: 'startsWithSlash',
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
if (!this.deploymentId) {
|
|
105
|
+
result.push({
|
|
106
|
+
field: 'deploymentId',
|
|
107
|
+
message: 'Deployment ID must not be empty',
|
|
108
|
+
rule: 'notEmpty',
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
if (!this.customDomainId) {
|
|
112
|
+
result.push({
|
|
113
|
+
field: 'customDomainId',
|
|
114
|
+
message: 'Custom domain ID must not be empty',
|
|
115
|
+
rule: 'notEmpty',
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
return result
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SdkBase,
|
|
3
|
-
E_RESPONSE_STATUS,
|
|
4
|
-
E_RESPONSE_NO_VALUE,
|
|
5
|
-
E_INVALID_JSON,
|
|
6
|
-
E_RESPONSE_UNKNOWN,
|
|
7
|
-
SdkOptions,
|
|
8
|
-
} from './SdkBase.js'
|
|
1
|
+
import { SdkBase, E_RESPONSE_STATUS, SdkOptions } from './SdkBase.js'
|
|
9
2
|
import { ContextListResult, ContextListOptions, ContextChangeRecord } from '../events/BaseEvents.js'
|
|
10
3
|
import type {
|
|
11
4
|
DataCatalogSchema,
|
|
@@ -19,7 +12,6 @@ import { DataCatalogKind, DataCatalogVersionKind } from '../models/kinds.js'
|
|
|
19
12
|
import type { DataCatalogVersionSchema } from '../models/DataCatalogVersion.js'
|
|
20
13
|
import type { ForeignDomainDependency } from '../modeling/types.js'
|
|
21
14
|
import type { DataDomainSchema } from '../modeling/DataDomain.js'
|
|
22
|
-
import { Exception } from '../exceptions/exception.js'
|
|
23
15
|
|
|
24
16
|
export interface DataCatalogListOptions extends ContextListOptions {
|
|
25
17
|
scope?: DataCatalogScope
|
|
@@ -38,26 +30,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
38
30
|
url.searchParams.set('scope', opts.scope)
|
|
39
31
|
}
|
|
40
32
|
const result = await this.sdk.http.get(url.toString(), { token })
|
|
41
|
-
this.
|
|
42
|
-
const E_PREFIX = 'Unable to list data domains. '
|
|
43
|
-
if (result.status !== 200) {
|
|
44
|
-
this.logInvalidResponse(result)
|
|
45
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
46
|
-
}
|
|
47
|
-
if (!result.body) {
|
|
48
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let data: ContextListResult<DataCatalogSchemaWithVersion>
|
|
52
|
-
try {
|
|
53
|
-
data = JSON.parse(result.body)
|
|
54
|
-
} catch {
|
|
55
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
56
|
-
}
|
|
57
|
-
if (!Array.isArray(data.items)) {
|
|
58
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
59
|
-
}
|
|
60
|
-
return data
|
|
33
|
+
return this.processListResponse<DataCatalogSchemaWithVersion>(result, 'Unable to list data domains. ')
|
|
61
34
|
}
|
|
62
35
|
|
|
63
36
|
/**
|
|
@@ -68,25 +41,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
68
41
|
const { token } = request
|
|
69
42
|
const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key))
|
|
70
43
|
const result = await this.sdk.http.get(url.toString(), { token })
|
|
71
|
-
this.
|
|
72
|
-
const E_PREFIX = 'Unable to list data domain versions. '
|
|
73
|
-
if (result.status !== 200) {
|
|
74
|
-
this.logInvalidResponse(result)
|
|
75
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
76
|
-
}
|
|
77
|
-
if (!result.body) {
|
|
78
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
79
|
-
}
|
|
80
|
-
let data: ContextListResult<DataCatalogVersionInfo>
|
|
81
|
-
try {
|
|
82
|
-
data = JSON.parse(result.body)
|
|
83
|
-
} catch {
|
|
84
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
85
|
-
}
|
|
86
|
-
if (!Array.isArray(data.items)) {
|
|
87
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
88
|
-
}
|
|
89
|
-
return data
|
|
44
|
+
return this.processListResponse<DataCatalogVersionInfo>(result, 'Unable to list data domain versions. ')
|
|
90
45
|
}
|
|
91
46
|
|
|
92
47
|
/**
|
|
@@ -112,19 +67,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
112
67
|
this.logInvalidResponse(result)
|
|
113
68
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
114
69
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
118
|
-
}
|
|
119
|
-
let data: ContextChangeRecord<DataCatalogSchema>
|
|
120
|
-
try {
|
|
121
|
-
data = JSON.parse(result.body)
|
|
122
|
-
} catch {
|
|
123
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
124
|
-
}
|
|
125
|
-
if (!data.key) {
|
|
126
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
127
|
-
}
|
|
70
|
+
const data = this.readResponseJSON<DataCatalogSchema>(result, E_PREFIX)
|
|
71
|
+
this.assertObjectKind(E_PREFIX, DataCatalogKind, data.kind)
|
|
128
72
|
return data
|
|
129
73
|
}
|
|
130
74
|
|
|
@@ -138,18 +82,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
138
82
|
this.logInvalidResponse(result)
|
|
139
83
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
140
84
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
let data: DataCatalogSchema
|
|
145
|
-
try {
|
|
146
|
-
data = JSON.parse(result.body)
|
|
147
|
-
} catch {
|
|
148
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
149
|
-
}
|
|
150
|
-
if (data.kind !== DataCatalogKind) {
|
|
151
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
152
|
-
}
|
|
85
|
+
const data = this.readResponseJSON<DataCatalogSchema>(result, E_PREFIX)
|
|
86
|
+
this.assertObjectKind(E_PREFIX, DataCatalogKind, data.kind)
|
|
153
87
|
return data
|
|
154
88
|
}
|
|
155
89
|
|
|
@@ -180,18 +114,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
180
114
|
this.logInvalidResponse(result)
|
|
181
115
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
182
116
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
let data: ContextChangeRecord<DataCatalogSchema>
|
|
187
|
-
try {
|
|
188
|
-
data = JSON.parse(result.body)
|
|
189
|
-
} catch {
|
|
190
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
191
|
-
}
|
|
192
|
-
if (data.kind !== DataCatalogKind) {
|
|
193
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
194
|
-
}
|
|
117
|
+
const data = this.readResponseJSON<DataCatalogSchema>(result, E_PREFIX)
|
|
118
|
+
this.assertObjectKind(E_PREFIX, DataCatalogKind, data.kind)
|
|
195
119
|
return data
|
|
196
120
|
}
|
|
197
121
|
|
|
@@ -211,18 +135,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
211
135
|
this.logInvalidResponse(result)
|
|
212
136
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
213
137
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
let data: ContextChangeRecord<DataCatalogSchema>
|
|
218
|
-
try {
|
|
219
|
-
data = JSON.parse(result.body)
|
|
220
|
-
} catch {
|
|
221
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
222
|
-
}
|
|
223
|
-
if (data.kind !== DataCatalogKind) {
|
|
224
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
225
|
-
}
|
|
138
|
+
const data = this.readResponseJSON<DataCatalogSchema>(result, E_PREFIX)
|
|
139
|
+
this.assertObjectKind(E_PREFIX, DataCatalogKind, data.kind)
|
|
226
140
|
return data
|
|
227
141
|
}
|
|
228
142
|
|
|
@@ -247,18 +161,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
247
161
|
this.logInvalidResponse(result)
|
|
248
162
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
249
163
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
254
|
-
try {
|
|
255
|
-
data = JSON.parse(result.body)
|
|
256
|
-
} catch {
|
|
257
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
258
|
-
}
|
|
259
|
-
if (data.kind !== DataCatalogVersionKind) {
|
|
260
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
261
|
-
}
|
|
164
|
+
const data = this.readResponseJSON<DataCatalogVersionSchema>(result, E_PREFIX)
|
|
165
|
+
this.assertObjectKind(E_PREFIX, DataCatalogVersionKind, data.kind)
|
|
262
166
|
return data
|
|
263
167
|
}
|
|
264
168
|
|
|
@@ -272,18 +176,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
272
176
|
this.logInvalidResponse(result)
|
|
273
177
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
274
178
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
let data: DataCatalogVersionSchema
|
|
279
|
-
try {
|
|
280
|
-
data = JSON.parse(result.body)
|
|
281
|
-
} catch {
|
|
282
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
283
|
-
}
|
|
284
|
-
if (data.kind !== DataCatalogVersionKind) {
|
|
285
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
286
|
-
}
|
|
179
|
+
const data = this.readResponseJSON<DataCatalogVersionSchema>(result, E_PREFIX)
|
|
180
|
+
this.assertObjectKind(E_PREFIX, DataCatalogVersionKind, data.kind)
|
|
287
181
|
return data
|
|
288
182
|
}
|
|
289
183
|
|
|
@@ -301,25 +195,7 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
301
195
|
'content-type': 'application/json',
|
|
302
196
|
},
|
|
303
197
|
})
|
|
304
|
-
this.
|
|
305
|
-
const E_PREFIX = 'Unable to list data domain dependencies. '
|
|
306
|
-
if (result.status !== 200) {
|
|
307
|
-
this.logInvalidResponse(result)
|
|
308
|
-
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
309
|
-
}
|
|
310
|
-
if (!result.body) {
|
|
311
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status })
|
|
312
|
-
}
|
|
313
|
-
let data: ContextListResult<DataDomainSchema>
|
|
314
|
-
try {
|
|
315
|
-
data = JSON.parse(result.body)
|
|
316
|
-
} catch {
|
|
317
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
318
|
-
}
|
|
319
|
-
if (!Array.isArray(data.items)) {
|
|
320
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
321
|
-
}
|
|
322
|
-
return data
|
|
198
|
+
return this.processListResponse<DataDomainSchema>(result, 'Unable to list data domain dependencies. ')
|
|
323
199
|
}
|
|
324
200
|
|
|
325
201
|
async deprecateVersion(
|
|
@@ -344,18 +220,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
344
220
|
this.logInvalidResponse(result)
|
|
345
221
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
346
222
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
351
|
-
try {
|
|
352
|
-
data = JSON.parse(result.body)
|
|
353
|
-
} catch {
|
|
354
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
355
|
-
}
|
|
356
|
-
if (data.kind !== DataCatalogVersionKind) {
|
|
357
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
358
|
-
}
|
|
223
|
+
const data = this.readResponseJSON<DataCatalogVersionSchema>(result, E_PREFIX)
|
|
224
|
+
this.assertObjectKind(E_PREFIX, DataCatalogVersionKind, data.kind)
|
|
359
225
|
return data
|
|
360
226
|
}
|
|
361
227
|
|
|
@@ -373,18 +239,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
373
239
|
this.logInvalidResponse(result)
|
|
374
240
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
375
241
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
let data: ContextChangeRecord<DataCatalogVersionSchema>
|
|
380
|
-
try {
|
|
381
|
-
data = JSON.parse(result.body)
|
|
382
|
-
} catch {
|
|
383
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
384
|
-
}
|
|
385
|
-
if (data.kind !== DataCatalogVersionKind) {
|
|
386
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
387
|
-
}
|
|
242
|
+
const data = this.readResponseJSON<DataCatalogVersionSchema>(result, E_PREFIX)
|
|
243
|
+
this.assertObjectKind(E_PREFIX, DataCatalogVersionKind, data.kind)
|
|
388
244
|
return data
|
|
389
245
|
}
|
|
390
246
|
|
|
@@ -408,18 +264,8 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
408
264
|
this.logInvalidResponse(result)
|
|
409
265
|
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body)
|
|
410
266
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
let data: DataCatalogStatus
|
|
415
|
-
try {
|
|
416
|
-
data = JSON.parse(result.body)
|
|
417
|
-
} catch {
|
|
418
|
-
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status })
|
|
419
|
-
}
|
|
420
|
-
if (data.kind !== DataCatalogKind) {
|
|
421
|
-
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status })
|
|
422
|
-
}
|
|
267
|
+
const data = this.readResponseJSON<DataCatalogStatus>(result, E_PREFIX)
|
|
268
|
+
this.assertObjectKind(E_PREFIX, DataCatalogKind, data.kind)
|
|
423
269
|
return data
|
|
424
270
|
}
|
|
425
271
|
}
|