@api-client/core 0.12.2 → 0.12.4

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.
Files changed (66) hide show
  1. package/build/src/browser.d.ts +2 -0
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js +2 -0
  4. package/build/src/browser.js.map +1 -1
  5. package/build/src/events/BaseEvents.d.ts +11 -1
  6. package/build/src/events/BaseEvents.d.ts.map +1 -1
  7. package/build/src/events/BaseEvents.js.map +1 -1
  8. package/build/src/index.d.ts +2 -0
  9. package/build/src/index.d.ts.map +1 -1
  10. package/build/src/index.js +2 -0
  11. package/build/src/index.js.map +1 -1
  12. package/build/src/modeling/DomainVersioning.d.ts +2 -2
  13. package/build/src/modeling/DomainVersioning.d.ts.map +1 -1
  14. package/build/src/modeling/DomainVersioning.js +16 -1
  15. package/build/src/modeling/DomainVersioning.js.map +1 -1
  16. package/build/src/modeling/validation/entity_validation.js +2 -2
  17. package/build/src/modeling/validation/entity_validation.js.map +1 -1
  18. package/build/src/modeling/validation/rules.js +2 -2
  19. package/build/src/modeling/validation/rules.js.map +1 -1
  20. package/build/src/models/DataCatalog.d.ts +142 -0
  21. package/build/src/models/DataCatalog.d.ts.map +1 -0
  22. package/build/src/models/DataCatalog.js +120 -0
  23. package/build/src/models/DataCatalog.js.map +1 -0
  24. package/build/src/models/DataCatalogVersion.d.ts +123 -0
  25. package/build/src/models/DataCatalogVersion.d.ts.map +1 -0
  26. package/build/src/models/DataCatalogVersion.js +118 -0
  27. package/build/src/models/DataCatalogVersion.js.map +1 -0
  28. package/build/src/models/kinds.d.ts +2 -0
  29. package/build/src/models/kinds.d.ts.map +1 -1
  30. package/build/src/models/kinds.js +2 -0
  31. package/build/src/models/kinds.js.map +1 -1
  32. package/build/src/runtime/store/DataCatalogSdk.d.ts +46 -0
  33. package/build/src/runtime/store/DataCatalogSdk.d.ts.map +1 -0
  34. package/build/src/runtime/store/DataCatalogSdk.js +425 -0
  35. package/build/src/runtime/store/DataCatalogSdk.js.map +1 -0
  36. package/build/src/runtime/store/RouteBuilder.d.ts +10 -0
  37. package/build/src/runtime/store/RouteBuilder.d.ts.map +1 -1
  38. package/build/src/runtime/store/RouteBuilder.js +30 -0
  39. package/build/src/runtime/store/RouteBuilder.js.map +1 -1
  40. package/build/src/runtime/store/Sdk.d.ts +2 -0
  41. package/build/src/runtime/store/Sdk.d.ts.map +1 -1
  42. package/build/src/runtime/store/Sdk.js +10 -2
  43. package/build/src/runtime/store/Sdk.js.map +1 -1
  44. package/build/src/runtime/store/StoreSdkNode.d.ts +1 -0
  45. package/build/src/runtime/store/StoreSdkNode.d.ts.map +1 -1
  46. package/build/src/runtime/store/StoreSdkNode.js.map +1 -1
  47. package/build/src/runtime/store/StoreSdkWeb.d.ts +1 -0
  48. package/build/src/runtime/store/StoreSdkWeb.d.ts.map +1 -1
  49. package/build/src/runtime/store/StoreSdkWeb.js.map +1 -1
  50. package/data/models/example-generator-api.json +6 -6
  51. package/package.json +1 -1
  52. package/src/events/BaseEvents.ts +11 -1
  53. package/src/modeling/DomainVersioning.ts +18 -3
  54. package/src/modeling/validation/entity_validation.ts +2 -2
  55. package/src/modeling/validation/rules.ts +2 -2
  56. package/src/models/DataCatalog.ts +260 -0
  57. package/src/models/DataCatalogVersion.ts +235 -0
  58. package/src/models/kinds.ts +2 -0
  59. package/src/runtime/store/DataCatalogSdk.ts +473 -0
  60. package/src/runtime/store/RouteBuilder.ts +40 -0
  61. package/src/runtime/store/Sdk.ts +11 -2
  62. package/src/runtime/store/StoreSdkNode.ts +1 -0
  63. package/src/runtime/store/StoreSdkWeb.ts +1 -0
  64. package/tests/unit/modeling/validation/association_validation.spec.ts +17 -0
  65. package/tests/unit/modeling/validation/entity_validation.spec.ts +1 -1
  66. package/tests/unit/modeling/validation/property_validation.spec.ts +10 -0
@@ -0,0 +1,473 @@
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'
9
+ import { ContextListResult, ContextListOptions, ContextChangeRecord } from '../../events/BaseEvents.js'
10
+ import type {
11
+ DataCatalogSchema,
12
+ DataCatalogSchemaWithVersion,
13
+ DataCatalogScope,
14
+ DataCatalogStatus,
15
+ } from '../../models/DataCatalog.js'
16
+ import { RouteBuilder } from './RouteBuilder.js'
17
+ import { SdkError } from './Errors.js'
18
+ import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js'
19
+ import type { DataCatalogVersionSchema } from '../../models/DataCatalogVersion.js'
20
+ import type { ForeignDomainDependency } from '../../modeling/types.js'
21
+ import type { DataDomainSchema } from '../../modeling/DataDomain.js'
22
+
23
+ export interface DataCatalogListOptions extends ContextListOptions {
24
+ scope?: DataCatalogScope
25
+ }
26
+
27
+ export class DataCatalogSdk extends SdkBase {
28
+ async list(
29
+ options: DataCatalogListOptions = {},
30
+ request: SdkOptions = {}
31
+ ): Promise<ContextListResult<DataCatalogSchemaWithVersion>> {
32
+ const { token } = request
33
+ const opts = { ...options }
34
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalog())
35
+ this.sdk.appendListOptions(url, opts)
36
+ if (opts.scope) {
37
+ url.searchParams.set('scope', opts.scope)
38
+ }
39
+ const result = await this.sdk.http.get(url.toString(), { token })
40
+ this.inspectCommonStatusCodes(result)
41
+ const E_PREFIX = 'Unable to list data domains. '
42
+ if (result.status !== 200) {
43
+ this.logInvalidResponse(result)
44
+ let e = this.createGenericSdkError(result.body)
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
50
+ }
51
+ if (!result.body) {
52
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
53
+ }
54
+
55
+ let data: ContextListResult<DataCatalogSchemaWithVersion>
56
+ try {
57
+ data = JSON.parse(result.body)
58
+ } catch {
59
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
60
+ }
61
+ if (!Array.isArray(data.items)) {
62
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
63
+ }
64
+ return data
65
+ }
66
+
67
+ async listVersions(
68
+ key: string,
69
+ request: SdkOptions = {}
70
+ ): Promise<ContextListResult<{ key: string; version: string; published: number }>> {
71
+ const { token } = request
72
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key))
73
+ const result = await this.sdk.http.get(url.toString(), { token })
74
+ this.inspectCommonStatusCodes(result)
75
+ const E_PREFIX = 'Unable to list data domain versions. '
76
+ if (result.status !== 200) {
77
+ this.logInvalidResponse(result)
78
+ let e = this.createGenericSdkError(result.body)
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
84
+ }
85
+ if (!result.body) {
86
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
87
+ }
88
+ let data: ContextListResult<{ key: string; version: string; published: number }>
89
+ try {
90
+ data = JSON.parse(result.body)
91
+ } catch {
92
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
93
+ }
94
+ if (!Array.isArray(data.items)) {
95
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
96
+ }
97
+ return data
98
+ }
99
+
100
+ /**
101
+ * Publishes a new data catalog entry.
102
+ * To publish a version, use the `publishVersion` method.
103
+ * @param entry The data catalog entry to publish.
104
+ * @returns The created data catalog entry.
105
+ */
106
+ async publish(entry: DataCatalogSchema, request: SdkOptions = {}): Promise<ContextChangeRecord<DataCatalogSchema>> {
107
+ const { token } = request
108
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalog())
109
+ const body = JSON.stringify(entry)
110
+ const result = await this.sdk.http.post(url.toString(), {
111
+ token,
112
+ body,
113
+ headers: {
114
+ 'content-type': 'application/json',
115
+ },
116
+ })
117
+ this.inspectCommonStatusCodes(result)
118
+ const E_PREFIX = 'Unable to publish data domain. '
119
+ if (result.status !== 200) {
120
+ this.logInvalidResponse(result)
121
+ let e = this.createGenericSdkError(result.body)
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
127
+ }
128
+
129
+ if (!result.body) {
130
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
131
+ }
132
+ let data: ContextChangeRecord<DataCatalogSchema>
133
+ try {
134
+ data = JSON.parse(result.body)
135
+ } catch {
136
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
137
+ }
138
+ if (!data.key) {
139
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
140
+ }
141
+ return data
142
+ }
143
+
144
+ async read(key: string, request: SdkOptions = {}): Promise<DataCatalogSchema> {
145
+ const { token } = request
146
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntry(key))
147
+ const result = await this.sdk.http.get(url.toString(), { token })
148
+ this.inspectCommonStatusCodes(result)
149
+ const E_PREFIX = 'Unable to read data domain. '
150
+ if (result.status !== 200) {
151
+ this.logInvalidResponse(result)
152
+ let e = this.createGenericSdkError(result.body)
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
158
+ }
159
+ if (!result.body) {
160
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
161
+ }
162
+ let data: DataCatalogSchema
163
+ try {
164
+ data = JSON.parse(result.body)
165
+ } catch {
166
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
167
+ }
168
+ if (data.kind !== DataCatalogKind) {
169
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
170
+ }
171
+ return data
172
+ }
173
+
174
+ /**
175
+ * Deprecates the entire data catalog entry.
176
+ * To deprecate a version, use the `deprecateVersion` method.
177
+ * @param key The key of the data catalog entry to deprecate.
178
+ * @param reason The reason for deprecation.
179
+ */
180
+ async deprecate(
181
+ key: string,
182
+ reason: string,
183
+ request: SdkOptions = {}
184
+ ): Promise<ContextChangeRecord<DataCatalogSchema>> {
185
+ const { token } = request
186
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogDeprecate(key))
187
+ const body = JSON.stringify({ reason })
188
+ const result = await this.sdk.http.put(url.toString(), {
189
+ token,
190
+ body,
191
+ headers: {
192
+ 'content-type': 'application/json',
193
+ },
194
+ })
195
+ this.inspectCommonStatusCodes(result)
196
+ const E_PREFIX = 'Unable to deprecate data domain. '
197
+ if (result.status !== 200) {
198
+ this.logInvalidResponse(result)
199
+ let e = this.createGenericSdkError(result.body)
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
205
+ }
206
+ if (!result.body) {
207
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
208
+ }
209
+ let data: ContextChangeRecord<DataCatalogSchema>
210
+ try {
211
+ data = JSON.parse(result.body)
212
+ } catch {
213
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
214
+ }
215
+ if (data.kind !== DataCatalogKind) {
216
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
217
+ }
218
+ return data
219
+ }
220
+
221
+ /**
222
+ * Removes the data catalog entry from the catalog. The entry is preserved in the database
223
+ * and the user can still access it. It is used to recover from error when the entry was published
224
+ * by mistake.
225
+ * @param key The key of the data catalog entry to unpublish.
226
+ */
227
+ async unpublish(key: string, request: SdkOptions = {}): Promise<ContextChangeRecord<DataCatalogSchema>> {
228
+ const { token } = request
229
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogUnpublish(key))
230
+ const result = await this.sdk.http.put(url.toString(), { token })
231
+ this.inspectCommonStatusCodes(result)
232
+ const E_PREFIX = 'Unable to unpublish data domain. '
233
+ if (result.status !== 200) {
234
+ this.logInvalidResponse(result)
235
+ let e = this.createGenericSdkError(result.body)
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
241
+ }
242
+ if (!result.body) {
243
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
244
+ }
245
+ let data: ContextChangeRecord<DataCatalogSchema>
246
+ try {
247
+ data = JSON.parse(result.body)
248
+ } catch {
249
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
250
+ }
251
+ if (data.kind !== DataCatalogKind) {
252
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
253
+ }
254
+ return data
255
+ }
256
+
257
+ async publishVersion(
258
+ key: string,
259
+ version: DataCatalogVersionSchema,
260
+ request: SdkOptions = {}
261
+ ): Promise<ContextChangeRecord<DataCatalogVersionSchema>> {
262
+ const { token } = request
263
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key))
264
+ const body = JSON.stringify(version)
265
+ const result = await this.sdk.http.post(url.toString(), {
266
+ token,
267
+ body,
268
+ headers: {
269
+ 'content-type': 'application/json',
270
+ },
271
+ })
272
+ this.inspectCommonStatusCodes(result)
273
+ const E_PREFIX = 'Unable to publish data domain version. '
274
+ if (result.status !== 200) {
275
+ this.logInvalidResponse(result)
276
+ let e = this.createGenericSdkError(result.body)
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
282
+ }
283
+ if (!result.body) {
284
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
285
+ }
286
+ let data: ContextChangeRecord<DataCatalogVersionSchema>
287
+ try {
288
+ data = JSON.parse(result.body)
289
+ } catch {
290
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
291
+ }
292
+ if (data.kind !== DataCatalogVersionKind) {
293
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
294
+ }
295
+ return data
296
+ }
297
+
298
+ async readVersion(key: string, version: string, request: SdkOptions = {}): Promise<DataCatalogVersionSchema> {
299
+ const { token } = request
300
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version))
301
+ const result = await this.sdk.http.get(url.toString(), { token })
302
+ this.inspectCommonStatusCodes(result)
303
+ const E_PREFIX = 'Unable to read data domain version. '
304
+ if (result.status !== 200) {
305
+ this.logInvalidResponse(result)
306
+ let e = this.createGenericSdkError(result.body)
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
312
+ }
313
+ if (!result.body) {
314
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
315
+ }
316
+ let data: DataCatalogVersionSchema
317
+ try {
318
+ data = JSON.parse(result.body)
319
+ } catch {
320
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
321
+ }
322
+ if (data.kind !== DataCatalogVersionKind) {
323
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
324
+ }
325
+ return data
326
+ }
327
+
328
+ async listDependencies(
329
+ dependencies?: ForeignDomainDependency[],
330
+ request: SdkOptions = {}
331
+ ): Promise<ContextListResult<DataDomainSchema[]>> {
332
+ const { token } = request
333
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogDependencies())
334
+ const body = JSON.stringify({ items: dependencies })
335
+ const result = await this.sdk.http.post(url.toString(), {
336
+ token,
337
+ body,
338
+ headers: {
339
+ 'content-type': 'application/json',
340
+ },
341
+ })
342
+ this.inspectCommonStatusCodes(result)
343
+ const E_PREFIX = 'Unable to list data domain dependencies. '
344
+ if (result.status !== 200) {
345
+ this.logInvalidResponse(result)
346
+ let e = this.createGenericSdkError(result.body)
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
352
+ }
353
+ if (!result.body) {
354
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
355
+ }
356
+ let data: ContextListResult<DataDomainSchema[]>
357
+ try {
358
+ data = JSON.parse(result.body)
359
+ } catch {
360
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
361
+ }
362
+ if (!Array.isArray(data.items)) {
363
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
364
+ }
365
+ return data
366
+ }
367
+
368
+ async deprecateVersion(
369
+ key: string,
370
+ version: string,
371
+ reason: string,
372
+ request: SdkOptions = {}
373
+ ): Promise<ContextChangeRecord<DataCatalogVersionSchema>> {
374
+ const { token } = request
375
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version))
376
+ const body = JSON.stringify({ reason })
377
+ const result = await this.sdk.http.put(url.toString(), {
378
+ token,
379
+ body,
380
+ headers: {
381
+ 'content-type': 'application/json',
382
+ },
383
+ })
384
+ this.inspectCommonStatusCodes(result)
385
+ const E_PREFIX = 'Unable to deprecate data domain version. '
386
+ if (result.status !== 200) {
387
+ this.logInvalidResponse(result)
388
+ let e = this.createGenericSdkError(result.body)
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
394
+ }
395
+ if (!result.body) {
396
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
397
+ }
398
+ let data: ContextChangeRecord<DataCatalogVersionSchema>
399
+ try {
400
+ data = JSON.parse(result.body)
401
+ } catch {
402
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
403
+ }
404
+ if (data.kind !== DataCatalogVersionKind) {
405
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
406
+ }
407
+ return data
408
+ }
409
+
410
+ async unpublishVersion(
411
+ key: string,
412
+ version: string,
413
+ request: SdkOptions = {}
414
+ ): Promise<ContextChangeRecord<DataCatalogVersionSchema>> {
415
+ const { token } = request
416
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version))
417
+ const result = await this.sdk.http.put(url.toString(), { token })
418
+ this.inspectCommonStatusCodes(result)
419
+ const E_PREFIX = 'Unable to unpublish data domain version. '
420
+ if (result.status !== 200) {
421
+ this.logInvalidResponse(result)
422
+ let e = this.createGenericSdkError(result.body)
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
428
+ }
429
+ if (!result.body) {
430
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
431
+ }
432
+ let data: ContextChangeRecord<DataCatalogVersionSchema>
433
+ try {
434
+ data = JSON.parse(result.body)
435
+ } catch {
436
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
437
+ }
438
+ if (data.kind !== DataCatalogVersionKind) {
439
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
440
+ }
441
+ return data
442
+ }
443
+
444
+ async checkPublicationStatus(domainId: string, request: SdkOptions = {}): Promise<DataCatalogStatus> {
445
+ const { token } = request
446
+ const url = this.sdk.getUrl(RouteBuilder.dataCatalogStatus(domainId))
447
+ const result = await this.sdk.http.get(url.toString(), { token })
448
+ this.inspectCommonStatusCodes(result)
449
+ const E_PREFIX = 'Unable to check data domain publication status. '
450
+ if (result.status !== 200) {
451
+ this.logInvalidResponse(result)
452
+ let e = this.createGenericSdkError(result.body)
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
458
+ }
459
+ if (!result.body) {
460
+ throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`)
461
+ }
462
+ let data: DataCatalogStatus
463
+ try {
464
+ data = JSON.parse(result.body)
465
+ } catch {
466
+ throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`)
467
+ }
468
+ if (data.kind !== DataCatalogKind) {
469
+ throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`)
470
+ }
471
+ return data
472
+ }
473
+ }
@@ -198,4 +198,44 @@ export class RouteBuilder {
198
198
  static user(oid: string, key: string): string {
199
199
  return `/v1/orgs/${oid}/users/${key}`
200
200
  }
201
+
202
+ static dataCatalog(): string {
203
+ return '/v1/datacatalog'
204
+ }
205
+
206
+ static dataCatalogStatus(domainId: string): string {
207
+ return `${RouteBuilder.dataCatalog()}/status/${domainId}`
208
+ }
209
+
210
+ static dataCatalogEntry(domainId: string): string {
211
+ return `${RouteBuilder.dataCatalog()}/${domainId}`
212
+ }
213
+
214
+ static dataCatalogEntryVersions(entryId: string): string {
215
+ return `${RouteBuilder.dataCatalogEntry(entryId)}/versions`
216
+ }
217
+
218
+ static dataCatalogDependencies(): string {
219
+ return `${RouteBuilder.dataCatalog()}/dependencies`
220
+ }
221
+
222
+ static dataCatalogVersion(entryId: string, version: string): string {
223
+ return `${RouteBuilder.dataCatalogEntry(entryId)}/${version}`
224
+ }
225
+
226
+ static dataCatalogDeprecate(entryId: string): string {
227
+ return `${RouteBuilder.dataCatalogEntry(entryId)}/deprecate`
228
+ }
229
+
230
+ static dataCatalogUnpublish(entryId: string): string {
231
+ return `${RouteBuilder.dataCatalogEntry(entryId)}/unpublish`
232
+ }
233
+
234
+ static dataCatalogVersionDeprecate(entryId: string, version: string): string {
235
+ return `${RouteBuilder.dataCatalogVersion(entryId, version)}/deprecate`
236
+ }
237
+
238
+ static dataCatalogVersionUnpublish(entryId: string, version: string): string {
239
+ return `${RouteBuilder.dataCatalogVersion(entryId, version)}/unpublish`
240
+ }
201
241
  }
@@ -10,6 +10,7 @@ import { RevisionsSdk } from './RevisionsSdk.js'
10
10
  import { TrashSdk } from './TrashSdk.js'
11
11
  import { ProjectExecutionSdk } from './ProjectExecutionsSdk.js'
12
12
  import { OrganizationsSdk } from './OrganizationsSdk.js'
13
+ import { DataCatalogSdk } from './DataCatalogSdk.js'
13
14
 
14
15
  const baseUriSymbol = Symbol('baseUri')
15
16
 
@@ -67,6 +68,8 @@ export abstract class Sdk {
67
68
  projectExecution = new ProjectExecutionSdk(this)
68
69
 
69
70
  organization = new OrganizationsSdk(this)
71
+
72
+ dataCatalog = new DataCatalogSdk(this)
70
73
  /**
71
74
  * When set it limits log output to minimum.
72
75
  */
@@ -164,8 +167,14 @@ export abstract class Sdk {
164
167
  if (options.since) {
165
168
  searchParams.set('since', String(options.since))
166
169
  }
167
- if (options.orderField) {
168
- searchParams.set('orderField', String(options.since))
170
+ if (options.sort) {
171
+ searchParams.set('sort', String(options.sort))
172
+ }
173
+ if (options.order) {
174
+ searchParams.set('order', String(options.order))
175
+ }
176
+ if (options.oid) {
177
+ searchParams.set('oid', String(options.oid))
169
178
  }
170
179
  if (typeof options.descending === 'boolean') {
171
180
  searchParams.set('descending', String(options.descending))
@@ -13,6 +13,7 @@ export type {
13
13
  IOrganizationRegistrationInfo,
14
14
  IOrganizationAddUserInfo,
15
15
  } from './UsersSdk.js'
16
+ export type { DataCatalogListOptions } from './DataCatalogSdk.js'
16
17
 
17
18
  /**
18
19
  * NodeJS API for API Client's net-store module.
@@ -13,6 +13,7 @@ export type {
13
13
  IOrganizationRegistrationInfo,
14
14
  IOrganizationAddUserInfo,
15
15
  } from './UsersSdk.js'
16
+ export type { DataCatalogListOptions } from './DataCatalogSdk.js'
16
17
 
17
18
  /**
18
19
  * NodeJS API for API Client's net-store module.
@@ -90,6 +90,23 @@ test.group('AssociationValidation', (group) => {
90
90
  assert.equal(results[0].severity, 'error')
91
91
  })
92
92
 
93
+ test('validateName() should return an error when the association name is too short', ({ assert }) => {
94
+ const model = domain.addModel({ key: 'model' })
95
+ const entity1 = model.addEntity({ key: 'entity1', info: { name: 'Entity1' } })
96
+ const entity2 = model.addEntity({ key: 'entity2', info: { name: 'Entity2' } })
97
+ const association = entity1.addAssociation(
98
+ { key: entity2.key },
99
+ {
100
+ key: 'a',
101
+ info: { name: 'a' },
102
+ }
103
+ )
104
+ const results = validation.validateName(association)
105
+ assert.lengthOf(results, 1)
106
+ assert.equal(results[0].rule, 'length')
107
+ assert.equal(results[0].severity, 'error')
108
+ })
109
+
93
110
  test('validateName() should return an error when the association name is too long', ({ assert }) => {
94
111
  const model = domain.addModel({ key: 'model' })
95
112
  const entity1 = model.addEntity({ key: 'entity1', info: { name: 'Entity1' } })
@@ -90,7 +90,7 @@ test.group('EntityValidation', (group) => {
90
90
 
91
91
  test('validateName() should return an error when the entity name is too short', ({ assert }) => {
92
92
  const model = domain.addModel({ key: 'model' })
93
- const entity = model.addEntity({ key: 'entity', info: { name: 'ab' } })
93
+ const entity = model.addEntity({ key: 'entity', info: { name: 'a' } })
94
94
  const results = validation.validateName(entity)
95
95
  assert.lengthOf(results, 1)
96
96
  assert.equal(results[0].rule, 'length')
@@ -64,6 +64,16 @@ test.group('PropertyValidation', (group) => {
64
64
  assert.equal(results[0].severity, 'error')
65
65
  })
66
66
 
67
+ test('validateName() should return an error when the property name is too short', ({ assert }) => {
68
+ const model = domain.addModel({ key: 'model' })
69
+ const entity = model.addEntity({ key: 'entity', info: { name: 'Entity' } })
70
+ const property = entity.addProperty({ key: 'a', type: 'string', info: { name: 'a' } })
71
+ const results = validation.validateName(property)
72
+ assert.lengthOf(results, 1)
73
+ assert.equal(results[0].rule, 'length')
74
+ assert.equal(results[0].severity, 'error')
75
+ })
76
+
67
77
  test('validateName() should return an error when the property name is too long', ({ assert }) => {
68
78
  const model = domain.addModel({ key: 'model' })
69
79
  const entity = model.addEntity({ key: 'entity', info: { name: 'Entity' } })