@api-client/core 0.12.10 → 0.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/browser.d.ts +0 -1
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +0 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/exceptions/exception.d.ts +29 -1
- package/build/src/exceptions/exception.d.ts.map +1 -1
- package/build/src/exceptions/exception.js +37 -1
- package/build/src/exceptions/exception.js.map +1 -1
- package/build/src/index.d.ts +0 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +0 -1
- package/build/src/index.js.map +1 -1
- package/build/src/proxy/HttpProjectProxy.d.ts.map +1 -1
- package/build/src/proxy/HttpProjectProxy.js +39 -43
- package/build/src/proxy/HttpProjectProxy.js.map +1 -1
- package/build/src/proxy/RequestProxy.d.ts.map +1 -1
- package/build/src/proxy/RequestProxy.js +11 -11
- package/build/src/proxy/RequestProxy.js.map +1 -1
- package/build/src/runtime/store/DataCatalogSdk.d.ts.map +1 -1
- package/build/src/runtime/store/DataCatalogSdk.js +49 -109
- package/build/src/runtime/store/DataCatalogSdk.js.map +1 -1
- package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
- package/build/src/runtime/store/FilesSdk.js +51 -115
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/build/src/runtime/store/HistorySdk.d.ts.map +1 -1
- package/build/src/runtime/store/HistorySdk.js +25 -70
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/runtime/store/OrganizationsSdk.js +46 -50
- package/build/src/runtime/store/OrganizationsSdk.js.map +1 -1
- package/build/src/runtime/store/RevisionsSdk.d.ts.map +1 -1
- package/build/src/runtime/store/RevisionsSdk.js +5 -10
- package/build/src/runtime/store/RevisionsSdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.d.ts +7 -5
- package/build/src/runtime/store/SdkBase.d.ts.map +1 -1
- package/build/src/runtime/store/SdkBase.js +45 -63
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts.map +1 -1
- package/build/src/runtime/store/SharedSdk.js +5 -14
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/TrashSdk.d.ts.map +1 -1
- package/build/src/runtime/store/TrashSdk.js +8 -28
- package/build/src/runtime/store/TrashSdk.js.map +1 -1
- package/build/src/runtime/store/UsersSdk.d.ts.map +1 -1
- package/build/src/runtime/store/UsersSdk.js +12 -11
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/data/models/example-generator-api.json +8 -8
- package/package.json +1 -1
- package/src/exceptions/exception.ts +51 -4
- package/src/proxy/HttpProjectProxy.ts +39 -43
- package/src/proxy/RequestProxy.ts +11 -11
- package/src/runtime/store/DataCatalogSdk.ts +49 -109
- package/src/runtime/store/FilesSdk.ts +51 -115
- package/src/runtime/store/HistorySdk.ts +25 -70
- package/src/runtime/store/OrganizationsSdk.ts +46 -50
- package/src/runtime/store/RevisionsSdk.ts +5 -10
- package/src/runtime/store/SdkBase.ts +46 -65
- package/src/runtime/store/SharedSdk.ts +5 -14
- package/src/runtime/store/TrashSdk.ts +8 -28
- package/src/runtime/store/UsersSdk.ts +12 -11
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +42 -40
- package/tests/unit/runtime/proxy/RequestProxy.spec.ts +11 -11
- package/build/src/runtime/store/Errors.d.ts +0 -51
- package/build/src/runtime/store/Errors.d.ts.map +0 -1
- package/build/src/runtime/store/Errors.js +0 -61
- package/build/src/runtime/store/Errors.js.map +0 -1
- package/src/runtime/store/Errors.ts +0 -98
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HttpProject } from '../models/HttpProject.js';
|
|
2
|
-
import { ApiError } from '../runtime/store/Errors.js';
|
|
3
2
|
import { StoreSdk } from '../runtime/store/StoreSdkNode.js';
|
|
4
3
|
import { ProjectSerialRunner } from '../runtime/node/ProjectSerialRunner.js';
|
|
5
4
|
import { ProjectParallelRunner } from '../runtime/node/ProjectParallelRunner.js';
|
|
6
5
|
import Proxy from './Proxy.js';
|
|
6
|
+
import { Exception } from '../exceptions/exception.js';
|
|
7
7
|
/**
|
|
8
8
|
* Runs requests from an HTTP project read from the store.
|
|
9
9
|
*/
|
|
@@ -12,52 +12,48 @@ export default class HttpProjectProxy extends Proxy {
|
|
|
12
12
|
options;
|
|
13
13
|
async configureStore(init, token, baseUri) {
|
|
14
14
|
const { pid, options, organization } = init;
|
|
15
|
+
const INVALID_REQUEST = 'Invalid request';
|
|
16
|
+
const code = 'E_INVALID_REQUEST';
|
|
15
17
|
if (!pid) {
|
|
16
|
-
throw new
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
code: 400,
|
|
18
|
+
throw new Exception(INVALID_REQUEST, {
|
|
19
|
+
help: 'The "pid" parameter is required.',
|
|
20
|
+
status: 400,
|
|
21
|
+
code,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
if (!organization) {
|
|
24
|
-
throw new
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
code: 400,
|
|
25
|
+
throw new Exception(INVALID_REQUEST, {
|
|
26
|
+
help: 'The "organization" parameter is required.',
|
|
27
|
+
status: 400,
|
|
28
|
+
code,
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
if (!options) {
|
|
32
|
-
throw new
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
code: 400,
|
|
32
|
+
throw new Exception(INVALID_REQUEST, {
|
|
33
|
+
help: 'The "options" parameter is required.',
|
|
34
|
+
status: 400,
|
|
35
|
+
code,
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
if (!token) {
|
|
40
|
-
throw new
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
code: 400,
|
|
39
|
+
throw new Exception(INVALID_REQUEST, {
|
|
40
|
+
help: 'Set the authentication credentials.',
|
|
41
|
+
status: 400,
|
|
42
|
+
code,
|
|
45
43
|
});
|
|
46
44
|
}
|
|
47
45
|
if (!baseUri) {
|
|
48
|
-
throw new
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
code: 400,
|
|
46
|
+
throw new Exception(INVALID_REQUEST, {
|
|
47
|
+
help: 'The store uri is missing.',
|
|
48
|
+
status: 400,
|
|
49
|
+
code,
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
if (!baseUri.startsWith('http')) {
|
|
56
|
-
throw new
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
code: 400,
|
|
53
|
+
throw new Exception(INVALID_REQUEST, {
|
|
54
|
+
help: 'The store uri is invalid.',
|
|
55
|
+
status: 400,
|
|
56
|
+
code,
|
|
61
57
|
});
|
|
62
58
|
}
|
|
63
59
|
const sdk = new StoreSdk(baseUri);
|
|
@@ -69,30 +65,30 @@ export default class HttpProjectProxy extends Proxy {
|
|
|
69
65
|
}
|
|
70
66
|
catch (cause) {
|
|
71
67
|
const e = cause;
|
|
72
|
-
throw new
|
|
68
|
+
throw new Exception(e.message, { status: 400 });
|
|
73
69
|
}
|
|
74
70
|
if (project.key !== pid) {
|
|
75
|
-
throw new
|
|
71
|
+
throw new Exception(`Unable to read the project.`, { status: 500 });
|
|
76
72
|
}
|
|
77
73
|
this.options = options;
|
|
78
74
|
this.project = new HttpProject(project);
|
|
79
75
|
}
|
|
80
76
|
async configureProject(init) {
|
|
81
77
|
const { project, options } = init;
|
|
78
|
+
const INVALID_REQUEST = 'Invalid request';
|
|
79
|
+
const code = 'E_INVALID_REQUEST';
|
|
82
80
|
if (!options) {
|
|
83
|
-
throw new
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
code: 400,
|
|
81
|
+
throw new Exception(INVALID_REQUEST, {
|
|
82
|
+
help: 'The "options" parameter is required.',
|
|
83
|
+
status: 400,
|
|
84
|
+
code,
|
|
88
85
|
});
|
|
89
86
|
}
|
|
90
87
|
if (!project) {
|
|
91
|
-
throw new
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
code: 400,
|
|
88
|
+
throw new Exception(INVALID_REQUEST, {
|
|
89
|
+
help: 'The "project" parameter is required.',
|
|
90
|
+
status: 400,
|
|
91
|
+
code,
|
|
96
92
|
});
|
|
97
93
|
}
|
|
98
94
|
this.options = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpProjectProxy.js","sourceRoot":"","sources":["../../../src/proxy/HttpProjectProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,WAAW,EAAgB,MAAM,0BAA0B,CAAA;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HttpProjectProxy.js","sourceRoot":"","sources":["../../../src/proxy/HttpProjectProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,WAAW,EAAgB,MAAM,0BAA0B,CAAA;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,KAAuB,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AA8BtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK;IACjD,OAAO,CAAc;IACrB,OAAO,CAAwB;IAErB,KAAK,CAAC,cAAc,CAAC,IAAgC,EAAE,KAAa,EAAE,OAAe;QAC7F,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;QAC3C,MAAM,eAAe,GAAG,iBAAiB,CAAA;QACzC,MAAM,IAAI,GAAG,mBAAmB,CAAA;QAChC,IAAI,CAAC,GAAG,EAAE,CAA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,MAAM,UAAU,GAAG,IAAkC,CAAA;QACrD,IAAI,OAAO,UAAU,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,KAAe,EAAE,OAAiB,CAAC,CAAA;QAC5E,CAAC;QACD,MAAM,YAAY,GAAG,IAA6B,CAAA;QAClD,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,OAAsB,CAAA;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAgC,CAAA;QAClD,IAAI,OAAoD,CAAA;QACxD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,GAAG,IAAI,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACpD,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAA;YACnC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;QAED,SAAS,kBAAkB;YACzB,EAAE;QACJ,CAAC;QACD,4DAA4D;QAC5D,wEAAwE;QACxE,yEAAyE;QACzE,6CAA6C;QAC7C,uCAAuC;QACvC,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAA;QACpD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;QACtC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAA;QACrD,OAAO;YACL,MAAM,EAAE,MAAM;SACf,CAAA;IACH,CAAC;CACF","sourcesContent":["import { IProjectRunnerOptions } from '../runtime/node/InteropInterfaces.js'\nimport { Kind as HttpProjectKind, HttpProject, IHttpProject } from '../models/HttpProject.js'\nimport { StoreSdk } from '../runtime/store/StoreSdkNode.js'\nimport { ProjectSerialRunner } from '../runtime/node/ProjectSerialRunner.js'\nimport { ProjectParallelRunner } from '../runtime/node/ProjectParallelRunner.js'\nimport Proxy, { IProxyResult } from './Proxy.js'\nimport { IProjectExecutionLog } from '../models/ProjectExecution.js'\nimport { Exception } from '../exceptions/exception.js'\n\ninterface ProxyInit {\n kind: typeof HttpProjectKind\n /**\n * Runner options.\n */\n options: IProjectRunnerOptions\n /**\n * A signal to be sent to the proxy bindings to abort the request on demand.\n */\n signal?: AbortSignal | null\n}\n\nexport interface IHttpProjectProxyInit extends ProxyInit {\n project: IHttpProject\n}\n\nexport interface IHttpProjectStoreProxyInit extends ProxyInit {\n kind: typeof HttpProjectKind\n /**\n * Project key\n */\n pid: string\n /**\n * The parent organization key.\n */\n organization: string\n}\n\n/**\n * Runs requests from an HTTP project read from the store.\n */\nexport default class HttpProjectProxy extends Proxy {\n project?: HttpProject\n options?: IProjectRunnerOptions\n\n protected async configureStore(init: IHttpProjectStoreProxyInit, token: string, baseUri: string): Promise<void> {\n const { pid, options, organization } = init\n const INVALID_REQUEST = 'Invalid request'\n const code = 'E_INVALID_REQUEST'\n if (!pid) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"pid\" parameter is required.',\n status: 400,\n code,\n })\n }\n if (!organization) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"organization\" parameter is required.',\n status: 400,\n code,\n })\n }\n if (!options) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"options\" parameter is required.',\n status: 400,\n code,\n })\n }\n if (!token) {\n throw new Exception(INVALID_REQUEST, {\n help: 'Set the authentication credentials.',\n status: 400,\n code,\n })\n }\n if (!baseUri) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The store uri is missing.',\n status: 400,\n code,\n })\n }\n if (!baseUri.startsWith('http')) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The store uri is invalid.',\n status: 400,\n code,\n })\n }\n const sdk = new StoreSdk(baseUri)\n sdk.token = token\n let project: IHttpProject\n try {\n const data = await sdk.file.readMedia(organization, pid)\n project = data.media as IHttpProject\n } catch (cause) {\n const e = cause as Error\n throw new Exception(e.message, { status: 400 })\n }\n if (project.key !== pid) {\n throw new Exception(`Unable to read the project.`, { status: 500 })\n }\n this.options = options\n this.project = new HttpProject(project)\n }\n\n protected async configureProject(init: IHttpProjectProxyInit): Promise<void> {\n const { project, options } = init\n const INVALID_REQUEST = 'Invalid request'\n const code = 'E_INVALID_REQUEST'\n if (!options) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"options\" parameter is required.',\n status: 400,\n code,\n })\n }\n if (!project) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"project\" parameter is required.',\n status: 400,\n code,\n })\n }\n this.options = options\n this.project = new HttpProject(project)\n }\n\n async configure(\n init: IHttpProjectProxyInit | IHttpProjectStoreProxyInit,\n token?: string,\n baseUri?: string\n ): Promise<void> {\n const typedStore = init as IHttpProjectStoreProxyInit\n if (typeof typedStore.pid === 'string') {\n return this.configureStore(typedStore, token as string, baseUri as string)\n }\n const typedProject = init as IHttpProjectProxyInit\n return this.configureProject(typedProject)\n }\n\n async execute(): Promise<IProxyResult<IProjectExecutionLog>> {\n const project = this.project as HttpProject\n const opts = this.options as IProjectRunnerOptions\n let factory: ProjectParallelRunner | ProjectSerialRunner\n if (opts.parallel) {\n factory = new ProjectParallelRunner(project, opts)\n } else {\n factory = new ProjectSerialRunner()\n factory.configure(project, opts)\n }\n\n function unhandledRejection(): void {\n //\n }\n // the executing library handles all related errors it need.\n // However, when executing a request to an unknown host Node process may\n // throw unhandled error event when the error is properly reported by the\n // application. This suppresses these errors.\n // Note, uncomment this line for debug.\n process.on('unhandledRejection', unhandledRejection)\n const report = await factory.execute()\n process.off('unhandledRejection', unhandledRejection)\n return {\n result: report,\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestProxy.d.ts","sourceRoot":"","sources":["../../../src/proxy/RequestProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IA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AE,CAAA;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK;IAC7C,IAAI,CAAC,EAAE,iBAAiB,CAAA;IAElB,SAAS,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBjD,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;CAyBpD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Proxy from './Proxy.js';
|
|
2
|
-
import { ApiError } from '../runtime/store/Errors.js';
|
|
3
2
|
import { DummyLogger } from '../lib/logging/DummyLogger.js';
|
|
4
3
|
import { HttpRequestRunner } from '../runtime/http-runner/HttpRequestRunner.js';
|
|
4
|
+
import { Exception } from '../exceptions/exception.js';
|
|
5
5
|
/**
|
|
6
6
|
* Proxies a single HTTP request
|
|
7
7
|
*/
|
|
@@ -9,20 +9,20 @@ export default class RequestProxy extends Proxy {
|
|
|
9
9
|
init;
|
|
10
10
|
async configure(init) {
|
|
11
11
|
const { request } = init;
|
|
12
|
+
const INVALID_REQUEST = 'Invalid request';
|
|
13
|
+
const code = 'E_INVALID_REQUEST';
|
|
12
14
|
if (!request) {
|
|
13
|
-
throw new
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
code: 400,
|
|
15
|
+
throw new Exception(INVALID_REQUEST, {
|
|
16
|
+
help: 'The "request" parameter is required.',
|
|
17
|
+
status: 400,
|
|
18
|
+
code,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
if (!request.url) {
|
|
21
|
-
throw new
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
code: 400,
|
|
22
|
+
throw new Exception(INVALID_REQUEST, {
|
|
23
|
+
help: 'The "request.url" parameter is required.',
|
|
24
|
+
status: 400,
|
|
25
|
+
code,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
this.init = init;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestProxy.js","sourceRoot":"","sources":["../../../src/proxy/RequestProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAuB,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RequestProxy.js","sourceRoot":"","sources":["../../../src/proxy/RequestProxy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAuB,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAI/E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAsCtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK;IAC7C,IAAI,CAAoB;IAExB,KAAK,CAAC,SAAS,CAAC,IAAuB;QACrC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QACxB,MAAM,eAAe,GAAG,iBAAiB,CAAA;QACzC,MAAM,IAAI,GAAG,mBAAmB,CAAA;QAChC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,SAAS,CAAC,eAAe,EAAE;gBACnC,IAAI,EAAE,sCAAsC;gBAC5C,MAAM,EAAE,GAAG;gBACX,IAAI;aACL,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,IAAI,SAAS,CAAC,eAAe,EAAE;gBACnC,IAAI,EAAE,0CAA0C;gBAChD,MAAM,EAAE,GAAG;gBACX,IAAI;aACL,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAyB,CAAA;QAC3C,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;QACpG,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAE,CAAA;QACvC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAA;QAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;QAClC,OAAO,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAoB,CAAA;QAC/D,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;YACzD,OAAO,CAAC,aAAa,GAAG,aAAa,CAAA;QACvC,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACzC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACvB,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;QACjC,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,YAAY,GAAG,CAAC,WAAW,CAAC,CAAA;QACtC,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACzC,OAAO;YACL,MAAM,EAAE,MAAM;YACd,SAAS;SACV,CAAA;IACH,CAAC;CACF","sourcesContent":["import { IHttpRequest, Kind as HttpRequestKind } from '../models/HttpRequest.js'\nimport { IRequestAuthorization } from '../models/RequestAuthorization.js'\nimport { IRequestConfig } from '../models/RequestConfig.js'\nimport Proxy, { IProxyResult } from './Proxy.js'\nimport { HttpCertificate } from '../models/ClientCertificate.js'\nimport { DummyLogger } from '../lib/logging/DummyLogger.js'\nimport { HttpRequestRunner } from '../runtime/http-runner/HttpRequestRunner.js'\nimport { IRequestLog } from '../models/RequestLog.js'\nimport { IHttpFlow } from '../models/http-flows/HttpFlows.js'\nimport { IHttpAssertion } from '../models/http-flows/HttpAssertion.js'\nimport { Exception } from '../exceptions/exception.js'\n\nexport interface IRequestProxyInit {\n kind: typeof HttpRequestKind\n /**\n * The request to execute.\n */\n request: IHttpRequest\n /**\n * The authorization data to apply.\n */\n authorization?: IRequestAuthorization[]\n /**\n * The request configuration.\n */\n config?: IRequestConfig\n /**\n * The list of execution variables to use with the request.\n */\n variables?: Record<string, string>\n /**\n * The certificate data to use with the request.\n */\n certificate?: HttpCertificate\n /**\n * The request flows to execute with the request.\n */\n flows?: IHttpFlow[]\n /**\n * Assertions to execute with the request.\n */\n assertions?: IHttpAssertion[]\n /**\n * A signal to be sent to the proxy bindings to abort the request on demand.\n */\n signal?: AbortSignal | null\n}\n\n/**\n * Proxies a single HTTP request\n */\nexport default class RequestProxy extends Proxy {\n init?: IRequestProxyInit\n\n async configure(init: IRequestProxyInit): Promise<void> {\n const { request } = init\n const INVALID_REQUEST = 'Invalid request'\n const code = 'E_INVALID_REQUEST'\n if (!request) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"request\" parameter is required.',\n status: 400,\n code,\n })\n }\n if (!request.url) {\n throw new Exception(INVALID_REQUEST, {\n help: 'The \"request.url\" parameter is required.',\n status: 400,\n code,\n })\n }\n this.init = init\n }\n\n async execute(): Promise<IProxyResult<IRequestLog>> {\n const data = this.init as IRequestProxyInit\n const { request, authorization, certificate, config = {}, variables = {}, flows, assertions } = data\n const factory = new HttpRequestRunner()\n factory.variables = variables\n factory.logger = new DummyLogger()\n factory.config = { ...config, enabled: true } as IRequestConfig\n if (Array.isArray(authorization) && authorization.length) {\n factory.authorization = authorization\n }\n if (Array.isArray(flows) && flows.length) {\n factory.flows = flows\n }\n if (Array.isArray(assertions) && assertions.length) {\n factory.assertions = assertions\n }\n if (certificate) {\n factory.certificates = [certificate]\n }\n const result = await factory.run(request)\n return {\n result: result,\n variables,\n }\n }\n}\n"]}
|
|
@@ -1 +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;
|
|
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;AAGpC,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;AAGpE,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;IA+BrD,YAAY,CAChB,GAAG,EAAE,MAAM,EACX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AgCnD,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;IAyBnD,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAwBrG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, } from './SdkBase.js';
|
|
2
2
|
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
|
-
import { SdkError } from './Errors.js';
|
|
4
3
|
import { DataCatalogKind, DataCatalogVersionKind } from '../../models/kinds.js';
|
|
4
|
+
import { Exception } from '../../exceptions/exception.js';
|
|
5
5
|
export class DataCatalogSdk extends SdkBase {
|
|
6
6
|
async list(options = {}, request = {}) {
|
|
7
7
|
const { token } = request;
|
|
@@ -16,25 +16,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
16
16
|
const E_PREFIX = 'Unable to list data domains. ';
|
|
17
17
|
if (result.status !== 200) {
|
|
18
18
|
this.logInvalidResponse(result);
|
|
19
|
-
|
|
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;
|
|
19
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
25
20
|
}
|
|
26
21
|
if (!result.body) {
|
|
27
|
-
throw new
|
|
22
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
28
23
|
}
|
|
29
24
|
let data;
|
|
30
25
|
try {
|
|
31
26
|
data = JSON.parse(result.body);
|
|
32
27
|
}
|
|
33
28
|
catch {
|
|
34
|
-
throw new
|
|
29
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
35
30
|
}
|
|
36
31
|
if (!Array.isArray(data.items)) {
|
|
37
|
-
throw new
|
|
32
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
38
33
|
}
|
|
39
34
|
return data;
|
|
40
35
|
}
|
|
@@ -46,25 +41,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
46
41
|
const E_PREFIX = 'Unable to list data domain versions. ';
|
|
47
42
|
if (result.status !== 200) {
|
|
48
43
|
this.logInvalidResponse(result);
|
|
49
|
-
|
|
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;
|
|
44
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
55
45
|
}
|
|
56
46
|
if (!result.body) {
|
|
57
|
-
throw new
|
|
47
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
58
48
|
}
|
|
59
49
|
let data;
|
|
60
50
|
try {
|
|
61
51
|
data = JSON.parse(result.body);
|
|
62
52
|
}
|
|
63
53
|
catch {
|
|
64
|
-
throw new
|
|
54
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
65
55
|
}
|
|
66
56
|
if (!Array.isArray(data.items)) {
|
|
67
|
-
throw new
|
|
57
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
68
58
|
}
|
|
69
59
|
return data;
|
|
70
60
|
}
|
|
@@ -89,25 +79,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
89
79
|
const E_PREFIX = 'Unable to publish data domain. ';
|
|
90
80
|
if (result.status !== 200) {
|
|
91
81
|
this.logInvalidResponse(result);
|
|
92
|
-
|
|
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;
|
|
82
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
98
83
|
}
|
|
99
84
|
if (!result.body) {
|
|
100
|
-
throw new
|
|
85
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
101
86
|
}
|
|
102
87
|
let data;
|
|
103
88
|
try {
|
|
104
89
|
data = JSON.parse(result.body);
|
|
105
90
|
}
|
|
106
91
|
catch {
|
|
107
|
-
throw new
|
|
92
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
108
93
|
}
|
|
109
94
|
if (!data.key) {
|
|
110
|
-
throw new
|
|
95
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
111
96
|
}
|
|
112
97
|
return data;
|
|
113
98
|
}
|
|
@@ -119,25 +104,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
119
104
|
const E_PREFIX = 'Unable to read data domain. ';
|
|
120
105
|
if (result.status !== 200) {
|
|
121
106
|
this.logInvalidResponse(result);
|
|
122
|
-
|
|
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;
|
|
107
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
128
108
|
}
|
|
129
109
|
if (!result.body) {
|
|
130
|
-
throw new
|
|
110
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
131
111
|
}
|
|
132
112
|
let data;
|
|
133
113
|
try {
|
|
134
114
|
data = JSON.parse(result.body);
|
|
135
115
|
}
|
|
136
116
|
catch {
|
|
137
|
-
throw new
|
|
117
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
138
118
|
}
|
|
139
119
|
if (data.kind !== DataCatalogKind) {
|
|
140
|
-
throw new
|
|
120
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
141
121
|
}
|
|
142
122
|
return data;
|
|
143
123
|
}
|
|
@@ -162,25 +142,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
162
142
|
const E_PREFIX = 'Unable to deprecate data domain. ';
|
|
163
143
|
if (result.status !== 200) {
|
|
164
144
|
this.logInvalidResponse(result);
|
|
165
|
-
|
|
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;
|
|
145
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
171
146
|
}
|
|
172
147
|
if (!result.body) {
|
|
173
|
-
throw new
|
|
148
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
174
149
|
}
|
|
175
150
|
let data;
|
|
176
151
|
try {
|
|
177
152
|
data = JSON.parse(result.body);
|
|
178
153
|
}
|
|
179
154
|
catch {
|
|
180
|
-
throw new
|
|
155
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
181
156
|
}
|
|
182
157
|
if (data.kind !== DataCatalogKind) {
|
|
183
|
-
throw new
|
|
158
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
184
159
|
}
|
|
185
160
|
return data;
|
|
186
161
|
}
|
|
@@ -198,25 +173,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
198
173
|
const E_PREFIX = 'Unable to unpublish data domain. ';
|
|
199
174
|
if (result.status !== 200) {
|
|
200
175
|
this.logInvalidResponse(result);
|
|
201
|
-
|
|
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;
|
|
176
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
207
177
|
}
|
|
208
178
|
if (!result.body) {
|
|
209
|
-
throw new
|
|
179
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
210
180
|
}
|
|
211
181
|
let data;
|
|
212
182
|
try {
|
|
213
183
|
data = JSON.parse(result.body);
|
|
214
184
|
}
|
|
215
185
|
catch {
|
|
216
|
-
throw new
|
|
186
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
217
187
|
}
|
|
218
188
|
if (data.kind !== DataCatalogKind) {
|
|
219
|
-
throw new
|
|
189
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
220
190
|
}
|
|
221
191
|
return data;
|
|
222
192
|
}
|
|
@@ -235,25 +205,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
235
205
|
const E_PREFIX = 'Unable to publish data domain version. ';
|
|
236
206
|
if (result.status !== 200) {
|
|
237
207
|
this.logInvalidResponse(result);
|
|
238
|
-
|
|
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;
|
|
208
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
244
209
|
}
|
|
245
210
|
if (!result.body) {
|
|
246
|
-
throw new
|
|
211
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
247
212
|
}
|
|
248
213
|
let data;
|
|
249
214
|
try {
|
|
250
215
|
data = JSON.parse(result.body);
|
|
251
216
|
}
|
|
252
217
|
catch {
|
|
253
|
-
throw new
|
|
218
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
254
219
|
}
|
|
255
220
|
if (data.kind !== DataCatalogVersionKind) {
|
|
256
|
-
throw new
|
|
221
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
257
222
|
}
|
|
258
223
|
return data;
|
|
259
224
|
}
|
|
@@ -265,25 +230,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
265
230
|
const E_PREFIX = 'Unable to read data domain version. ';
|
|
266
231
|
if (result.status !== 200) {
|
|
267
232
|
this.logInvalidResponse(result);
|
|
268
|
-
|
|
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;
|
|
233
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
274
234
|
}
|
|
275
235
|
if (!result.body) {
|
|
276
|
-
throw new
|
|
236
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
277
237
|
}
|
|
278
238
|
let data;
|
|
279
239
|
try {
|
|
280
240
|
data = JSON.parse(result.body);
|
|
281
241
|
}
|
|
282
242
|
catch {
|
|
283
|
-
throw new
|
|
243
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
284
244
|
}
|
|
285
245
|
if (data.kind !== DataCatalogVersionKind) {
|
|
286
|
-
throw new
|
|
246
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
287
247
|
}
|
|
288
248
|
return data;
|
|
289
249
|
}
|
|
@@ -302,25 +262,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
302
262
|
const E_PREFIX = 'Unable to list data domain dependencies. ';
|
|
303
263
|
if (result.status !== 200) {
|
|
304
264
|
this.logInvalidResponse(result);
|
|
305
|
-
|
|
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;
|
|
265
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
311
266
|
}
|
|
312
267
|
if (!result.body) {
|
|
313
|
-
throw new
|
|
268
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
314
269
|
}
|
|
315
270
|
let data;
|
|
316
271
|
try {
|
|
317
272
|
data = JSON.parse(result.body);
|
|
318
273
|
}
|
|
319
274
|
catch {
|
|
320
|
-
throw new
|
|
275
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
321
276
|
}
|
|
322
277
|
if (!Array.isArray(data.items)) {
|
|
323
|
-
throw new
|
|
278
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
324
279
|
}
|
|
325
280
|
return data;
|
|
326
281
|
}
|
|
@@ -339,25 +294,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
339
294
|
const E_PREFIX = 'Unable to deprecate data domain version. ';
|
|
340
295
|
if (result.status !== 200) {
|
|
341
296
|
this.logInvalidResponse(result);
|
|
342
|
-
|
|
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;
|
|
297
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
348
298
|
}
|
|
349
299
|
if (!result.body) {
|
|
350
|
-
throw new
|
|
300
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
351
301
|
}
|
|
352
302
|
let data;
|
|
353
303
|
try {
|
|
354
304
|
data = JSON.parse(result.body);
|
|
355
305
|
}
|
|
356
306
|
catch {
|
|
357
|
-
throw new
|
|
307
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
358
308
|
}
|
|
359
309
|
if (data.kind !== DataCatalogVersionKind) {
|
|
360
|
-
throw new
|
|
310
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
361
311
|
}
|
|
362
312
|
return data;
|
|
363
313
|
}
|
|
@@ -369,25 +319,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
369
319
|
const E_PREFIX = 'Unable to unpublish data domain version. ';
|
|
370
320
|
if (result.status !== 200) {
|
|
371
321
|
this.logInvalidResponse(result);
|
|
372
|
-
|
|
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;
|
|
322
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
378
323
|
}
|
|
379
324
|
if (!result.body) {
|
|
380
|
-
throw new
|
|
325
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
381
326
|
}
|
|
382
327
|
let data;
|
|
383
328
|
try {
|
|
384
329
|
data = JSON.parse(result.body);
|
|
385
330
|
}
|
|
386
331
|
catch {
|
|
387
|
-
throw new
|
|
332
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
388
333
|
}
|
|
389
334
|
if (data.kind !== DataCatalogVersionKind) {
|
|
390
|
-
throw new
|
|
335
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
391
336
|
}
|
|
392
337
|
return data;
|
|
393
338
|
}
|
|
@@ -399,25 +344,20 @@ export class DataCatalogSdk extends SdkBase {
|
|
|
399
344
|
const E_PREFIX = 'Unable to check data domain publication status. ';
|
|
400
345
|
if (result.status !== 200) {
|
|
401
346
|
this.logInvalidResponse(result);
|
|
402
|
-
|
|
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;
|
|
347
|
+
throw this.createApiError(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`, result.body);
|
|
408
348
|
}
|
|
409
349
|
if (!result.body) {
|
|
410
|
-
throw new
|
|
350
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`, { code: 'E_RESPONSE_NO_VALUE', status: result.status });
|
|
411
351
|
}
|
|
412
352
|
let data;
|
|
413
353
|
try {
|
|
414
354
|
data = JSON.parse(result.body);
|
|
415
355
|
}
|
|
416
356
|
catch {
|
|
417
|
-
throw new
|
|
357
|
+
throw new Exception(`${E_PREFIX}${E_INVALID_JSON}`, { code: 'E_INVALID_JSON', status: result.status });
|
|
418
358
|
}
|
|
419
359
|
if (data.kind !== DataCatalogKind) {
|
|
420
|
-
throw new
|
|
360
|
+
throw new Exception(`${E_PREFIX}${E_RESPONSE_UNKNOWN}`, { code: 'E_RESPONSE_UNKNOWN', status: result.status });
|
|
421
361
|
}
|
|
422
362
|
return data;
|
|
423
363
|
}
|