@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.
- package/build/src/browser.d.ts +2 -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/events/BaseEvents.d.ts +11 -1
- package/build/src/events/BaseEvents.d.ts.map +1 -1
- package/build/src/events/BaseEvents.js.map +1 -1
- package/build/src/index.d.ts +2 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -0
- package/build/src/index.js.map +1 -1
- package/build/src/modeling/DomainVersioning.d.ts +2 -2
- package/build/src/modeling/DomainVersioning.d.ts.map +1 -1
- package/build/src/modeling/DomainVersioning.js +16 -1
- package/build/src/modeling/DomainVersioning.js.map +1 -1
- package/build/src/modeling/validation/entity_validation.js +2 -2
- package/build/src/modeling/validation/entity_validation.js.map +1 -1
- package/build/src/modeling/validation/rules.js +2 -2
- package/build/src/modeling/validation/rules.js.map +1 -1
- package/build/src/models/DataCatalog.d.ts +142 -0
- package/build/src/models/DataCatalog.d.ts.map +1 -0
- package/build/src/models/DataCatalog.js +120 -0
- package/build/src/models/DataCatalog.js.map +1 -0
- package/build/src/models/DataCatalogVersion.d.ts +123 -0
- package/build/src/models/DataCatalogVersion.d.ts.map +1 -0
- package/build/src/models/DataCatalogVersion.js +118 -0
- package/build/src/models/DataCatalogVersion.js.map +1 -0
- package/build/src/models/kinds.d.ts +2 -0
- package/build/src/models/kinds.d.ts.map +1 -1
- package/build/src/models/kinds.js +2 -0
- package/build/src/models/kinds.js.map +1 -1
- package/build/src/runtime/store/DataCatalogSdk.d.ts +46 -0
- package/build/src/runtime/store/DataCatalogSdk.d.ts.map +1 -0
- package/build/src/runtime/store/DataCatalogSdk.js +425 -0
- package/build/src/runtime/store/DataCatalogSdk.js.map +1 -0
- package/build/src/runtime/store/RouteBuilder.d.ts +10 -0
- package/build/src/runtime/store/RouteBuilder.d.ts.map +1 -1
- package/build/src/runtime/store/RouteBuilder.js +30 -0
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +2 -0
- package/build/src/runtime/store/Sdk.d.ts.map +1 -1
- package/build/src/runtime/store/Sdk.js +10 -2
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/StoreSdkNode.d.ts +1 -0
- package/build/src/runtime/store/StoreSdkNode.d.ts.map +1 -1
- package/build/src/runtime/store/StoreSdkNode.js.map +1 -1
- package/build/src/runtime/store/StoreSdkWeb.d.ts +1 -0
- package/build/src/runtime/store/StoreSdkWeb.d.ts.map +1 -1
- package/build/src/runtime/store/StoreSdkWeb.js.map +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/package.json +1 -1
- package/src/events/BaseEvents.ts +11 -1
- package/src/modeling/DomainVersioning.ts +18 -3
- package/src/modeling/validation/entity_validation.ts +2 -2
- package/src/modeling/validation/rules.ts +2 -2
- package/src/models/DataCatalog.ts +260 -0
- package/src/models/DataCatalogVersion.ts +235 -0
- package/src/models/kinds.ts +2 -0
- package/src/runtime/store/DataCatalogSdk.ts +473 -0
- package/src/runtime/store/RouteBuilder.ts +40 -0
- package/src/runtime/store/Sdk.ts +11 -2
- package/src/runtime/store/StoreSdkNode.ts +1 -0
- package/src/runtime/store/StoreSdkWeb.ts +1 -0
- package/tests/unit/modeling/validation/association_validation.spec.ts +17 -0
- package/tests/unit/modeling/validation/entity_validation.spec.ts +1 -1
- package/tests/unit/modeling/validation/property_validation.spec.ts +10 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { DataCatalogVersionKind } from './kinds.js';
|
|
2
|
+
export class DataCatalogVersion {
|
|
3
|
+
key;
|
|
4
|
+
get kind() {
|
|
5
|
+
return DataCatalogVersionKind;
|
|
6
|
+
}
|
|
7
|
+
catalogKey;
|
|
8
|
+
scope;
|
|
9
|
+
lifecycle;
|
|
10
|
+
version;
|
|
11
|
+
publishedBy;
|
|
12
|
+
unpublishedAt;
|
|
13
|
+
deprecated;
|
|
14
|
+
deprecatedAt;
|
|
15
|
+
deprecatedBy;
|
|
16
|
+
deprecationReason;
|
|
17
|
+
createdAt;
|
|
18
|
+
updatedAt;
|
|
19
|
+
changelog;
|
|
20
|
+
static createSchema(input) {
|
|
21
|
+
const { key = '', scope = 'private', publishedBy = '', createdAt = 0, updatedAt = 0, catalogKey = '', lifecycle = 'stable', version = '', } = input;
|
|
22
|
+
if (['public', 'private', 'organization'].indexOf(scope) === -1) {
|
|
23
|
+
throw new Error(`Invalid scope: ${scope}`);
|
|
24
|
+
}
|
|
25
|
+
const result = {
|
|
26
|
+
key,
|
|
27
|
+
kind: DataCatalogVersionKind,
|
|
28
|
+
scope,
|
|
29
|
+
publishedBy,
|
|
30
|
+
createdAt,
|
|
31
|
+
updatedAt,
|
|
32
|
+
catalogKey,
|
|
33
|
+
lifecycle,
|
|
34
|
+
version,
|
|
35
|
+
};
|
|
36
|
+
if (typeof input.deprecated === 'boolean') {
|
|
37
|
+
result.deprecated = input.deprecated;
|
|
38
|
+
}
|
|
39
|
+
if (typeof input.deprecatedAt === 'number') {
|
|
40
|
+
result.deprecatedAt = input.deprecatedAt;
|
|
41
|
+
}
|
|
42
|
+
if (typeof input.deprecatedBy === 'string') {
|
|
43
|
+
result.deprecatedBy = input.deprecatedBy;
|
|
44
|
+
}
|
|
45
|
+
if (typeof input.changelog === 'string') {
|
|
46
|
+
result.changelog = input.changelog;
|
|
47
|
+
}
|
|
48
|
+
if (typeof input.deprecationReason === 'string') {
|
|
49
|
+
result.deprecationReason = input.deprecationReason;
|
|
50
|
+
}
|
|
51
|
+
if (typeof input.unpublishedAt === 'number') {
|
|
52
|
+
result.unpublishedAt = input.unpublishedAt;
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
constructor(input = {}) {
|
|
57
|
+
const init = DataCatalogVersion.createSchema(input);
|
|
58
|
+
this.key = init.key;
|
|
59
|
+
this.catalogKey = init.catalogKey;
|
|
60
|
+
this.lifecycle = init.lifecycle;
|
|
61
|
+
this.scope = init.scope;
|
|
62
|
+
this.version = init.version;
|
|
63
|
+
this.publishedBy = init.publishedBy;
|
|
64
|
+
this.createdAt = init.createdAt;
|
|
65
|
+
this.updatedAt = init.updatedAt;
|
|
66
|
+
if (typeof init.changelog === 'string') {
|
|
67
|
+
this.changelog = init.changelog;
|
|
68
|
+
}
|
|
69
|
+
if (typeof init.deprecated === 'boolean') {
|
|
70
|
+
this.deprecated = init.deprecated;
|
|
71
|
+
}
|
|
72
|
+
if (typeof init.deprecatedAt === 'number') {
|
|
73
|
+
this.deprecatedAt = init.deprecatedAt;
|
|
74
|
+
}
|
|
75
|
+
if (typeof init.deprecatedBy === 'string') {
|
|
76
|
+
this.deprecatedBy = init.deprecatedBy;
|
|
77
|
+
}
|
|
78
|
+
if (typeof init.deprecationReason === 'string') {
|
|
79
|
+
this.deprecationReason = init.deprecationReason;
|
|
80
|
+
}
|
|
81
|
+
if (typeof init.unpublishedAt === 'number') {
|
|
82
|
+
this.unpublishedAt = init.unpublishedAt;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
toJSON() {
|
|
86
|
+
const result = {
|
|
87
|
+
key: this.key,
|
|
88
|
+
kind: DataCatalogVersionKind,
|
|
89
|
+
scope: this.scope,
|
|
90
|
+
publishedBy: this.publishedBy,
|
|
91
|
+
createdAt: this.createdAt,
|
|
92
|
+
updatedAt: this.updatedAt,
|
|
93
|
+
catalogKey: this.catalogKey,
|
|
94
|
+
lifecycle: this.lifecycle,
|
|
95
|
+
version: this.version,
|
|
96
|
+
};
|
|
97
|
+
if (typeof this.deprecated === 'boolean') {
|
|
98
|
+
result.deprecated = this.deprecated;
|
|
99
|
+
}
|
|
100
|
+
if (typeof this.deprecatedAt === 'number') {
|
|
101
|
+
result.deprecatedAt = this.deprecatedAt;
|
|
102
|
+
}
|
|
103
|
+
if (typeof this.deprecatedBy === 'string') {
|
|
104
|
+
result.deprecatedBy = this.deprecatedBy;
|
|
105
|
+
}
|
|
106
|
+
if (typeof this.deprecationReason === 'string') {
|
|
107
|
+
result.deprecationReason = this.deprecationReason;
|
|
108
|
+
}
|
|
109
|
+
if (typeof this.unpublishedAt === 'number') {
|
|
110
|
+
result.unpublishedAt = this.unpublishedAt;
|
|
111
|
+
}
|
|
112
|
+
if (typeof this.changelog === 'string' && this.changelog) {
|
|
113
|
+
result.changelog = this.changelog;
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=DataCatalogVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataCatalogVersion.js","sourceRoot":"","sources":["../../../src/models/DataCatalogVersion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAwGnD,MAAM,OAAO,kBAAkB;IAC7B,GAAG,CAAQ;IAEX,IAAI,IAAI;QACN,OAAO,sBAAsB,CAAA;IAC/B,CAAC;IAED,UAAU,CAAQ;IAClB,KAAK,CAAkB;IACvB,SAAS,CAAsB;IAC/B,OAAO,CAAQ;IACf,WAAW,CAAQ;IACnB,aAAa,CAAqB;IAClC,UAAU,CAAsB;IAChC,YAAY,CAAqB;IACjC,YAAY,CAAqB;IACjC,iBAAiB,CAAqB;IACtC,SAAS,CAAQ;IACjB,SAAS,CAAQ;IACjB,SAAS,CAAqB;IAE9B,MAAM,CAAC,YAAY,CAAC,KAAwC;QAC1D,MAAM,EACJ,GAAG,GAAG,EAAE,EACR,KAAK,GAAG,SAAS,EACjB,WAAW,GAAG,EAAE,EAChB,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,CAAC,EACb,UAAU,GAAG,EAAE,EACf,SAAS,GAAG,QAAQ,EACpB,OAAO,GAAG,EAAE,GACb,GAAG,KAAK,CAAA;QACT,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAA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I,CAAC,GAAG;YACb,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QACD,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QACrC,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QACnD,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC3C,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QAC3C,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACzD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAA;QACnC,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { DataCatalogScope } from './DataCatalog.js'\nimport { DataCatalogVersionKind } from './kinds.js'\n\nexport type DataCatalogLifecycle = 'stable' | 'beta' | 'dev'\n\nexport interface DataCatalogVersionSchema {\n /**\n * The key of the version.\n *\n * The key can only be set when creating a new data catalog entry.\n * @readonly\n */\n key: string\n /**\n * The kind of the schema\n */\n readonly kind: typeof DataCatalogVersionKind\n /**\n * The key of the parent data catalog entry.\n * It is only populated by the API when creating the version.\n * @readonly\n */\n catalogKey: string\n /**\n * The publication scope of the data catalog entry.\n *\n * When the scope is set to a different value than the one of the parent data catalog entry,\n * then this value is used to determine the visibility of the data catalog entry. However,\n * the reader cannot access the version with a \"public\" scope if the parent data catalog entry is private.\n *\n * @required\n */\n scope: DataCatalogScope\n /**\n * The lifecycle of the data catalog entry.\n *\n * - `stable`: The data catalog entry is stable and can be used in production.\n * - `beta`: The data catalog entry is in beta and may change in the future.\n * - `dev`: The data catalog entry is in development and likely will change in the future.\n *\n * The lifecycle is a readonly property and is set by the API when creating or updating the data catalog entry.\n * A version is immutable and to change the lifecycle, a new version must be created.\n *\n * @required\n */\n lifecycle: DataCatalogLifecycle\n /**\n * The version string according to the [semantic versioning](https://semver.org/) specification.\n * Note, this value is limited to 32 characters by the API.\n * @required\n */\n version: string\n /**\n * The id of the user who created the version.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n publishedBy: string\n /**\n * The timestamp when this version was unpublished.\n * Only set when the version was unpublished.\n * @readonly\n */\n unpublishedAt?: number\n /**\n * A flag indicating if the version is deprecated.\n * @readonly\n */\n deprecated?: boolean\n /**\n * The timestamp when the version was deprecated.\n * Only set when the version was deprecated.\n * @readonly\n */\n deprecatedAt?: number\n /**\n * The id of the user who deprecated the version.\n * Only set when the version was deprecated.\n * @readonly\n */\n deprecatedBy?: string\n /**\n * The reason why the version was deprecated.\n * Only set when the version was deprecated.\n */\n deprecationReason?: string\n /**\n * The timestamp when the data catalog entry was created.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n createdAt: number\n /**\n * The timestamp when the data catalog entry was last updated.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n updatedAt: number\n /**\n * The changelog of the data catalog entry.\n * Note, this value is required by the API when creating the version.\n */\n changelog?: string\n}\n\nexport class DataCatalogVersion implements DataCatalogVersionSchema {\n key: string\n\n get kind(): typeof DataCatalogVersionKind {\n return DataCatalogVersionKind\n }\n\n catalogKey: string\n scope: DataCatalogScope\n lifecycle: DataCatalogLifecycle\n version: string\n publishedBy: string\n unpublishedAt?: number | undefined\n deprecated?: boolean | undefined\n deprecatedAt?: number | undefined\n deprecatedBy?: string | undefined\n deprecationReason?: string | undefined\n createdAt: number\n updatedAt: number\n changelog?: string | undefined\n\n static createSchema(input: Partial<DataCatalogVersionSchema>): DataCatalogVersionSchema {\n const {\n key = '',\n scope = 'private',\n publishedBy = '',\n createdAt = 0,\n updatedAt = 0,\n catalogKey = '',\n lifecycle = 'stable',\n version = '',\n } = input\n if (['public', 'private', 'organization'].indexOf(scope) === -1) {\n throw new Error(`Invalid scope: ${scope}`)\n }\n const result: DataCatalogVersionSchema = {\n key,\n kind: DataCatalogVersionKind,\n scope,\n publishedBy,\n createdAt,\n updatedAt,\n catalogKey,\n lifecycle,\n version,\n }\n if (typeof input.deprecated === 'boolean') {\n result.deprecated = input.deprecated\n }\n if (typeof input.deprecatedAt === 'number') {\n result.deprecatedAt = input.deprecatedAt\n }\n if (typeof input.deprecatedBy === 'string') {\n result.deprecatedBy = input.deprecatedBy\n }\n if (typeof input.changelog === 'string') {\n result.changelog = input.changelog\n }\n if (typeof input.deprecationReason === 'string') {\n result.deprecationReason = input.deprecationReason\n }\n if (typeof input.unpublishedAt === 'number') {\n result.unpublishedAt = input.unpublishedAt\n }\n return result\n }\n\n constructor(input: Partial<DataCatalogVersionSchema> = {}) {\n const init = DataCatalogVersion.createSchema(input)\n this.key = init.key\n this.catalogKey = init.catalogKey\n this.lifecycle = init.lifecycle\n this.scope = init.scope\n this.version = init.version\n this.publishedBy = init.publishedBy\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n if (typeof init.changelog === 'string') {\n this.changelog = init.changelog\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n if (typeof init.deprecatedAt === 'number') {\n this.deprecatedAt = init.deprecatedAt\n }\n if (typeof init.deprecatedBy === 'string') {\n this.deprecatedBy = init.deprecatedBy\n }\n if (typeof init.deprecationReason === 'string') {\n this.deprecationReason = init.deprecationReason\n }\n if (typeof init.unpublishedAt === 'number') {\n this.unpublishedAt = init.unpublishedAt\n }\n }\n\n toJSON(): DataCatalogVersionSchema {\n const result: DataCatalogVersionSchema = {\n key: this.key,\n kind: DataCatalogVersionKind,\n scope: this.scope,\n publishedBy: this.publishedBy,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n catalogKey: this.catalogKey,\n lifecycle: this.lifecycle,\n version: this.version,\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n if (typeof this.deprecatedAt === 'number') {\n result.deprecatedAt = this.deprecatedAt\n }\n if (typeof this.deprecatedBy === 'string') {\n result.deprecatedBy = this.deprecatedBy\n }\n if (typeof this.deprecationReason === 'string') {\n result.deprecationReason = this.deprecationReason\n }\n if (typeof this.unpublishedAt === 'number') {\n result.unpublishedAt = this.unpublishedAt\n }\n if (typeof this.changelog === 'string' && this.changelog) {\n result.changelog = this.changelog\n }\n return result\n }\n}\n"]}
|
|
@@ -16,6 +16,8 @@ export declare const DomainModelKind = "Domain#Model";
|
|
|
16
16
|
export declare const DomainEntityKind = "Domain#Entity";
|
|
17
17
|
export declare const DomainAssociationKind = "Domain#Association";
|
|
18
18
|
export declare const DomainPropertyKind = "Domain#Property";
|
|
19
|
+
export declare const DataCatalogKind = "Core#DataCatalog";
|
|
20
|
+
export declare const DataCatalogVersionKind = "Core#DataCatalogVersion";
|
|
19
21
|
/**
|
|
20
22
|
* @deprecated Not used anymore.
|
|
21
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../src/models/kinds.ts"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Q,cAAc,CAAA;AACnC,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAC/C,eAAO,MAAM,cAAc,gBAAgB,CAAA;AAC3C,eAAO,MAAM,mBAAmB,qBAAqB,CAAA;AACrD,eAAO,MAAM,eAAe,iBAAiB,CAAA;AAC7C,eAAO,MAAM,gBAAgB,kBAAkB,CAAA;AAC/C,eAAO,MAAM,qBAAqB,uBAAuB,CAAA;AACzD,eAAO,MAAM,kBAAkB,oBAAoB,CAAA;AACnD,eAAO,MAAM,eAAe,qBAAqB,CAAA;AACjD,eAAO,MAAM,sBAAsB,4BAA4B,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAC3C;;GAEG;AACH,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AACrD;;GAEG;AACH,eAAO,MAAM,aAAa,mBAAmB,CAAA;AAC7C;;GAEG;AACH,eAAO,MAAM,cAAc,oBAAoB,CAAA;AAC/C;;GAEG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAA;AACzD;;GAEG;AACH,eAAO,MAAM,gBAAgB,sBAAsB,CAAA"}
|
|
@@ -16,6 +16,8 @@ export const DomainModelKind = 'Domain#Model';
|
|
|
16
16
|
export const DomainEntityKind = 'Domain#Entity';
|
|
17
17
|
export const DomainAssociationKind = 'Domain#Association';
|
|
18
18
|
export const DomainPropertyKind = 'Domain#Property';
|
|
19
|
+
export const DataCatalogKind = 'Core#DataCatalog';
|
|
20
|
+
export const DataCatalogVersionKind = 'Core#DataCatalogVersion';
|
|
19
21
|
/**
|
|
20
22
|
* @deprecated Not used anymore.
|
|
21
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../src/models/kinds.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAA;AAC/C,MAAM,CAA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ACrC,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAA;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAA;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAA;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAA;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAA;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAA;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAA;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AACnD,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAA;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAA;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAA;AAC3C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AACrD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAA;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAA;AAC/C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAA;AACzD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAA","sourcesContent":["export const ProjectFolderKind = 'Core#ProjectFolder'\nexport const ResponseKind = 'Core#HttpResponse'\nexport const HttpResponseKind = 'Core#HttpResponse'\nexport const CertificateFileKind = 'Core#CertificateFile'\nexport const FolderKind = 'Core#Folder'\nexport const ProjectKind = 'Core#Project'\nexport const ThingKind = 'Core#Thing'\nexport const DeletionKind = 'Core#Deletion'\nexport const RevisionKind = 'Core#Revision'\nexport const UnresolvedDependencyKind = 'Core#UnresolvedDependency'\nexport const UserKind = 'Core#User'\nexport const DomainFileKind = 'Data#DomainFile'\nexport const DataDomainKind = 'Data#Domain'\nexport const DomainNamespaceKind = 'Domain#Namespace'\nexport const DomainModelKind = 'Domain#Model'\nexport const DomainEntityKind = 'Domain#Entity'\nexport const DomainAssociationKind = 'Domain#Association'\nexport const DomainPropertyKind = 'Domain#Property'\nexport const DataCatalogKind = 'Core#DataCatalog'\nexport const DataCatalogVersionKind = 'Core#DataCatalogVersion'\n\n/**\n * @deprecated Not used anymore.\n */\nexport const DataFileKind = 'Core#DataFile'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataNamespaceKind = 'Data#DataNamespace'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataModelKind = 'Data#DataModel'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataEntityKind = 'Data#DataEntity'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataAssociationKind = 'Data#DataAssociation'\n/**\n * @deprecated Not used anymore.\n */\nexport const DataPropertyKind = 'Data#DataProperty'\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SdkBase, SdkOptions } from './SdkBase.js';
|
|
2
|
+
import { ContextListResult, ContextListOptions, ContextChangeRecord } from '../../events/BaseEvents.js';
|
|
3
|
+
import type { DataCatalogSchema, DataCatalogSchemaWithVersion, DataCatalogScope, DataCatalogStatus } from '../../models/DataCatalog.js';
|
|
4
|
+
import type { DataCatalogVersionSchema } from '../../models/DataCatalogVersion.js';
|
|
5
|
+
import type { ForeignDomainDependency } from '../../modeling/types.js';
|
|
6
|
+
import type { DataDomainSchema } from '../../modeling/DataDomain.js';
|
|
7
|
+
export interface DataCatalogListOptions extends ContextListOptions {
|
|
8
|
+
scope?: DataCatalogScope;
|
|
9
|
+
}
|
|
10
|
+
export declare class DataCatalogSdk extends SdkBase {
|
|
11
|
+
list(options?: DataCatalogListOptions, request?: SdkOptions): Promise<ContextListResult<DataCatalogSchemaWithVersion>>;
|
|
12
|
+
listVersions(key: string, request?: SdkOptions): Promise<ContextListResult<{
|
|
13
|
+
key: string;
|
|
14
|
+
version: string;
|
|
15
|
+
published: number;
|
|
16
|
+
}>>;
|
|
17
|
+
/**
|
|
18
|
+
* Publishes a new data catalog entry.
|
|
19
|
+
* To publish a version, use the `publishVersion` method.
|
|
20
|
+
* @param entry The data catalog entry to publish.
|
|
21
|
+
* @returns The created data catalog entry.
|
|
22
|
+
*/
|
|
23
|
+
publish(entry: DataCatalogSchema, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogSchema>>;
|
|
24
|
+
read(key: string, request?: SdkOptions): Promise<DataCatalogSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Deprecates the entire data catalog entry.
|
|
27
|
+
* To deprecate a version, use the `deprecateVersion` method.
|
|
28
|
+
* @param key The key of the data catalog entry to deprecate.
|
|
29
|
+
* @param reason The reason for deprecation.
|
|
30
|
+
*/
|
|
31
|
+
deprecate(key: string, reason: string, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogSchema>>;
|
|
32
|
+
/**
|
|
33
|
+
* Removes the data catalog entry from the catalog. The entry is preserved in the database
|
|
34
|
+
* and the user can still access it. It is used to recover from error when the entry was published
|
|
35
|
+
* by mistake.
|
|
36
|
+
* @param key The key of the data catalog entry to unpublish.
|
|
37
|
+
*/
|
|
38
|
+
unpublish(key: string, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogSchema>>;
|
|
39
|
+
publishVersion(key: string, version: DataCatalogVersionSchema, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogVersionSchema>>;
|
|
40
|
+
readVersion(key: string, version: string, request?: SdkOptions): Promise<DataCatalogVersionSchema>;
|
|
41
|
+
listDependencies(dependencies?: ForeignDomainDependency[], request?: SdkOptions): Promise<ContextListResult<DataDomainSchema[]>>;
|
|
42
|
+
deprecateVersion(key: string, version: string, reason: string, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogVersionSchema>>;
|
|
43
|
+
unpublishVersion(key: string, version: string, request?: SdkOptions): Promise<ContextChangeRecord<DataCatalogVersionSchema>>;
|
|
44
|
+
checkPublicationStatus(domainId: string, request?: SdkOptions): Promise<DataCatalogStatus>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=DataCatalogSdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataCatalogSdk.d.ts","sourceRoot":"","sources":["../../../../src/runtime/store/DataCatalogSdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAKP,UAAU,EACX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACvG,OAAO,KAAK,EACV,iBAAiB,EACjB,4BAA4B,EAC5B,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,6BAA6B,CAAA;AAIpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACzB;AAED,qBAAa,cAAe,SAAQ,OAAO;IACnC,IAAI,CACR,OAAO,GAAE,sBAA2B,EACpC,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;IAoCrD,YAAY,CAChB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,iBAAiB,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAA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A8BnD,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA6BrG"}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, } from './SdkBase.js';
|
|
2
|
+
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
|
+
import { SdkError } from './Errors.js';
|
|
4
|
+
import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js';
|
|
5
|
+
export class DataCatalogSdk extends SdkBase {
|
|
6
|
+
async list(options = {}, request = {}) {
|
|
7
|
+
const { token } = request;
|
|
8
|
+
const opts = { ...options };
|
|
9
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalog());
|
|
10
|
+
this.sdk.appendListOptions(url, opts);
|
|
11
|
+
if (opts.scope) {
|
|
12
|
+
url.searchParams.set('scope', opts.scope);
|
|
13
|
+
}
|
|
14
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
15
|
+
this.inspectCommonStatusCodes(result);
|
|
16
|
+
const E_PREFIX = 'Unable to list data domains. ';
|
|
17
|
+
if (result.status !== 200) {
|
|
18
|
+
this.logInvalidResponse(result);
|
|
19
|
+
let e = this.createGenericSdkError(result.body);
|
|
20
|
+
if (!e) {
|
|
21
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
22
|
+
e.response = result.body;
|
|
23
|
+
}
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
if (!result.body) {
|
|
27
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
28
|
+
}
|
|
29
|
+
let data;
|
|
30
|
+
try {
|
|
31
|
+
data = JSON.parse(result.body);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
35
|
+
}
|
|
36
|
+
if (!Array.isArray(data.items)) {
|
|
37
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
38
|
+
}
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
async listVersions(key, request = {}) {
|
|
42
|
+
const { token } = request;
|
|
43
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key));
|
|
44
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
45
|
+
this.inspectCommonStatusCodes(result);
|
|
46
|
+
const E_PREFIX = 'Unable to list data domain versions. ';
|
|
47
|
+
if (result.status !== 200) {
|
|
48
|
+
this.logInvalidResponse(result);
|
|
49
|
+
let e = this.createGenericSdkError(result.body);
|
|
50
|
+
if (!e) {
|
|
51
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
52
|
+
e.response = result.body;
|
|
53
|
+
}
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
if (!result.body) {
|
|
57
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
58
|
+
}
|
|
59
|
+
let data;
|
|
60
|
+
try {
|
|
61
|
+
data = JSON.parse(result.body);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
65
|
+
}
|
|
66
|
+
if (!Array.isArray(data.items)) {
|
|
67
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
68
|
+
}
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Publishes a new data catalog entry.
|
|
73
|
+
* To publish a version, use the `publishVersion` method.
|
|
74
|
+
* @param entry The data catalog entry to publish.
|
|
75
|
+
* @returns The created data catalog entry.
|
|
76
|
+
*/
|
|
77
|
+
async publish(entry, request = {}) {
|
|
78
|
+
const { token } = request;
|
|
79
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalog());
|
|
80
|
+
const body = JSON.stringify(entry);
|
|
81
|
+
const result = await this.sdk.http.post(url.toString(), {
|
|
82
|
+
token,
|
|
83
|
+
body,
|
|
84
|
+
headers: {
|
|
85
|
+
'content-type': 'application/json',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
this.inspectCommonStatusCodes(result);
|
|
89
|
+
const E_PREFIX = 'Unable to publish data domain. ';
|
|
90
|
+
if (result.status !== 200) {
|
|
91
|
+
this.logInvalidResponse(result);
|
|
92
|
+
let e = this.createGenericSdkError(result.body);
|
|
93
|
+
if (!e) {
|
|
94
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
95
|
+
e.response = result.body;
|
|
96
|
+
}
|
|
97
|
+
throw e;
|
|
98
|
+
}
|
|
99
|
+
if (!result.body) {
|
|
100
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
101
|
+
}
|
|
102
|
+
let data;
|
|
103
|
+
try {
|
|
104
|
+
data = JSON.parse(result.body);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
108
|
+
}
|
|
109
|
+
if (!data.key) {
|
|
110
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
111
|
+
}
|
|
112
|
+
return data;
|
|
113
|
+
}
|
|
114
|
+
async read(key, request = {}) {
|
|
115
|
+
const { token } = request;
|
|
116
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntry(key));
|
|
117
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
118
|
+
this.inspectCommonStatusCodes(result);
|
|
119
|
+
const E_PREFIX = 'Unable to read data domain. ';
|
|
120
|
+
if (result.status !== 200) {
|
|
121
|
+
this.logInvalidResponse(result);
|
|
122
|
+
let e = this.createGenericSdkError(result.body);
|
|
123
|
+
if (!e) {
|
|
124
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
125
|
+
e.response = result.body;
|
|
126
|
+
}
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
129
|
+
if (!result.body) {
|
|
130
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
131
|
+
}
|
|
132
|
+
let data;
|
|
133
|
+
try {
|
|
134
|
+
data = JSON.parse(result.body);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
138
|
+
}
|
|
139
|
+
if (data.kind !== DataCatalogKind) {
|
|
140
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
141
|
+
}
|
|
142
|
+
return data;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Deprecates the entire data catalog entry.
|
|
146
|
+
* To deprecate a version, use the `deprecateVersion` method.
|
|
147
|
+
* @param key The key of the data catalog entry to deprecate.
|
|
148
|
+
* @param reason The reason for deprecation.
|
|
149
|
+
*/
|
|
150
|
+
async deprecate(key, reason, request = {}) {
|
|
151
|
+
const { token } = request;
|
|
152
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogDeprecate(key));
|
|
153
|
+
const body = JSON.stringify({ reason });
|
|
154
|
+
const result = await this.sdk.http.put(url.toString(), {
|
|
155
|
+
token,
|
|
156
|
+
body,
|
|
157
|
+
headers: {
|
|
158
|
+
'content-type': 'application/json',
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
this.inspectCommonStatusCodes(result);
|
|
162
|
+
const E_PREFIX = 'Unable to deprecate data domain. ';
|
|
163
|
+
if (result.status !== 200) {
|
|
164
|
+
this.logInvalidResponse(result);
|
|
165
|
+
let e = this.createGenericSdkError(result.body);
|
|
166
|
+
if (!e) {
|
|
167
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
168
|
+
e.response = result.body;
|
|
169
|
+
}
|
|
170
|
+
throw e;
|
|
171
|
+
}
|
|
172
|
+
if (!result.body) {
|
|
173
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
174
|
+
}
|
|
175
|
+
let data;
|
|
176
|
+
try {
|
|
177
|
+
data = JSON.parse(result.body);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
181
|
+
}
|
|
182
|
+
if (data.kind !== DataCatalogKind) {
|
|
183
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
184
|
+
}
|
|
185
|
+
return data;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Removes the data catalog entry from the catalog. The entry is preserved in the database
|
|
189
|
+
* and the user can still access it. It is used to recover from error when the entry was published
|
|
190
|
+
* by mistake.
|
|
191
|
+
* @param key The key of the data catalog entry to unpublish.
|
|
192
|
+
*/
|
|
193
|
+
async unpublish(key, request = {}) {
|
|
194
|
+
const { token } = request;
|
|
195
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogUnpublish(key));
|
|
196
|
+
const result = await this.sdk.http.put(url.toString(), { token });
|
|
197
|
+
this.inspectCommonStatusCodes(result);
|
|
198
|
+
const E_PREFIX = 'Unable to unpublish data domain. ';
|
|
199
|
+
if (result.status !== 200) {
|
|
200
|
+
this.logInvalidResponse(result);
|
|
201
|
+
let e = this.createGenericSdkError(result.body);
|
|
202
|
+
if (!e) {
|
|
203
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
204
|
+
e.response = result.body;
|
|
205
|
+
}
|
|
206
|
+
throw e;
|
|
207
|
+
}
|
|
208
|
+
if (!result.body) {
|
|
209
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
210
|
+
}
|
|
211
|
+
let data;
|
|
212
|
+
try {
|
|
213
|
+
data = JSON.parse(result.body);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
217
|
+
}
|
|
218
|
+
if (data.kind !== DataCatalogKind) {
|
|
219
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
220
|
+
}
|
|
221
|
+
return data;
|
|
222
|
+
}
|
|
223
|
+
async publishVersion(key, version, request = {}) {
|
|
224
|
+
const { token } = request;
|
|
225
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogEntryVersions(key));
|
|
226
|
+
const body = JSON.stringify(version);
|
|
227
|
+
const result = await this.sdk.http.post(url.toString(), {
|
|
228
|
+
token,
|
|
229
|
+
body,
|
|
230
|
+
headers: {
|
|
231
|
+
'content-type': 'application/json',
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
this.inspectCommonStatusCodes(result);
|
|
235
|
+
const E_PREFIX = 'Unable to publish data domain version. ';
|
|
236
|
+
if (result.status !== 200) {
|
|
237
|
+
this.logInvalidResponse(result);
|
|
238
|
+
let e = this.createGenericSdkError(result.body);
|
|
239
|
+
if (!e) {
|
|
240
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
241
|
+
e.response = result.body;
|
|
242
|
+
}
|
|
243
|
+
throw e;
|
|
244
|
+
}
|
|
245
|
+
if (!result.body) {
|
|
246
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
247
|
+
}
|
|
248
|
+
let data;
|
|
249
|
+
try {
|
|
250
|
+
data = JSON.parse(result.body);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
254
|
+
}
|
|
255
|
+
if (data.kind !== DataCatalogVersionKind) {
|
|
256
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
257
|
+
}
|
|
258
|
+
return data;
|
|
259
|
+
}
|
|
260
|
+
async readVersion(key, version, request = {}) {
|
|
261
|
+
const { token } = request;
|
|
262
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version));
|
|
263
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
264
|
+
this.inspectCommonStatusCodes(result);
|
|
265
|
+
const E_PREFIX = 'Unable to read data domain version. ';
|
|
266
|
+
if (result.status !== 200) {
|
|
267
|
+
this.logInvalidResponse(result);
|
|
268
|
+
let e = this.createGenericSdkError(result.body);
|
|
269
|
+
if (!e) {
|
|
270
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
271
|
+
e.response = result.body;
|
|
272
|
+
}
|
|
273
|
+
throw e;
|
|
274
|
+
}
|
|
275
|
+
if (!result.body) {
|
|
276
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
277
|
+
}
|
|
278
|
+
let data;
|
|
279
|
+
try {
|
|
280
|
+
data = JSON.parse(result.body);
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
284
|
+
}
|
|
285
|
+
if (data.kind !== DataCatalogVersionKind) {
|
|
286
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
287
|
+
}
|
|
288
|
+
return data;
|
|
289
|
+
}
|
|
290
|
+
async listDependencies(dependencies, request = {}) {
|
|
291
|
+
const { token } = request;
|
|
292
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogDependencies());
|
|
293
|
+
const body = JSON.stringify({ items: dependencies });
|
|
294
|
+
const result = await this.sdk.http.post(url.toString(), {
|
|
295
|
+
token,
|
|
296
|
+
body,
|
|
297
|
+
headers: {
|
|
298
|
+
'content-type': 'application/json',
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
this.inspectCommonStatusCodes(result);
|
|
302
|
+
const E_PREFIX = 'Unable to list data domain dependencies. ';
|
|
303
|
+
if (result.status !== 200) {
|
|
304
|
+
this.logInvalidResponse(result);
|
|
305
|
+
let e = this.createGenericSdkError(result.body);
|
|
306
|
+
if (!e) {
|
|
307
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
308
|
+
e.response = result.body;
|
|
309
|
+
}
|
|
310
|
+
throw e;
|
|
311
|
+
}
|
|
312
|
+
if (!result.body) {
|
|
313
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
314
|
+
}
|
|
315
|
+
let data;
|
|
316
|
+
try {
|
|
317
|
+
data = JSON.parse(result.body);
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
321
|
+
}
|
|
322
|
+
if (!Array.isArray(data.items)) {
|
|
323
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
324
|
+
}
|
|
325
|
+
return data;
|
|
326
|
+
}
|
|
327
|
+
async deprecateVersion(key, version, reason, request = {}) {
|
|
328
|
+
const { token } = request;
|
|
329
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version));
|
|
330
|
+
const body = JSON.stringify({ reason });
|
|
331
|
+
const result = await this.sdk.http.put(url.toString(), {
|
|
332
|
+
token,
|
|
333
|
+
body,
|
|
334
|
+
headers: {
|
|
335
|
+
'content-type': 'application/json',
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
this.inspectCommonStatusCodes(result);
|
|
339
|
+
const E_PREFIX = 'Unable to deprecate data domain version. ';
|
|
340
|
+
if (result.status !== 200) {
|
|
341
|
+
this.logInvalidResponse(result);
|
|
342
|
+
let e = this.createGenericSdkError(result.body);
|
|
343
|
+
if (!e) {
|
|
344
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
345
|
+
e.response = result.body;
|
|
346
|
+
}
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
349
|
+
if (!result.body) {
|
|
350
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
351
|
+
}
|
|
352
|
+
let data;
|
|
353
|
+
try {
|
|
354
|
+
data = JSON.parse(result.body);
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
358
|
+
}
|
|
359
|
+
if (data.kind !== DataCatalogVersionKind) {
|
|
360
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
361
|
+
}
|
|
362
|
+
return data;
|
|
363
|
+
}
|
|
364
|
+
async unpublishVersion(key, version, request = {}) {
|
|
365
|
+
const { token } = request;
|
|
366
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogVersion(key, version));
|
|
367
|
+
const result = await this.sdk.http.put(url.toString(), { token });
|
|
368
|
+
this.inspectCommonStatusCodes(result);
|
|
369
|
+
const E_PREFIX = 'Unable to unpublish data domain version. ';
|
|
370
|
+
if (result.status !== 200) {
|
|
371
|
+
this.logInvalidResponse(result);
|
|
372
|
+
let e = this.createGenericSdkError(result.body);
|
|
373
|
+
if (!e) {
|
|
374
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
375
|
+
e.response = result.body;
|
|
376
|
+
}
|
|
377
|
+
throw e;
|
|
378
|
+
}
|
|
379
|
+
if (!result.body) {
|
|
380
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
381
|
+
}
|
|
382
|
+
let data;
|
|
383
|
+
try {
|
|
384
|
+
data = JSON.parse(result.body);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
388
|
+
}
|
|
389
|
+
if (data.kind !== DataCatalogVersionKind) {
|
|
390
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
391
|
+
}
|
|
392
|
+
return data;
|
|
393
|
+
}
|
|
394
|
+
async checkPublicationStatus(domainId, request = {}) {
|
|
395
|
+
const { token } = request;
|
|
396
|
+
const url = this.sdk.getUrl(RouteBuilder.dataCatalogStatus(domainId));
|
|
397
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
398
|
+
this.inspectCommonStatusCodes(result);
|
|
399
|
+
const E_PREFIX = 'Unable to check data domain publication status. ';
|
|
400
|
+
if (result.status !== 200) {
|
|
401
|
+
this.logInvalidResponse(result);
|
|
402
|
+
let e = this.createGenericSdkError(result.body);
|
|
403
|
+
if (!e) {
|
|
404
|
+
e = new SdkError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.status);
|
|
405
|
+
e.response = result.body;
|
|
406
|
+
}
|
|
407
|
+
throw e;
|
|
408
|
+
}
|
|
409
|
+
if (!result.body) {
|
|
410
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
411
|
+
}
|
|
412
|
+
let data;
|
|
413
|
+
try {
|
|
414
|
+
data = JSON.parse(result.body);
|
|
415
|
+
}
|
|
416
|
+
catch {
|
|
417
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
418
|
+
}
|
|
419
|
+
if (data.kind !== DataCatalogKind) {
|
|
420
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
421
|
+
}
|
|
422
|
+
return data;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
//# sourceMappingURL=DataCatalogSdk.js.map
|