@rockcarver/frodo-lib 2.0.0-1 → 2.0.0-2
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/CHANGELOG.md +5 -1
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/index.js +1 -105
- package/cjs/index.js.map +1 -1
- package/cjs/lib/FrodoLib.js +20 -20
- package/cjs/lib/FrodoLib.js.map +1 -1
- package/cjs/ops/AgentOps.js +8 -0
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +33 -6
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +36 -10
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +13 -126
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/IdmOps.js.map +1 -1
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/OAuth2OidcOps.js +84 -0
- package/cjs/ops/OAuth2OidcOps.js.map +1 -0
- package/cjs/ops/ResourceTypeOps.js +65 -49
- package/cjs/ops/ResourceTypeOps.js.map +1 -1
- package/cjs/ops/ServiceOps.js +3 -0
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +28 -14
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/cloud/LogOps.js +3 -13
- package/cjs/ops/cloud/LogOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +7 -7
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +109 -0
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
- package/cjs/ops/utils/Version.js +29 -6
- package/cjs/ops/utils/Version.js.map +1 -1
- package/cjs/ops/utils/Version.test.js.map +1 -1
- package/cjs/shared/State.js +0 -2
- package/cjs/shared/State.js.map +1 -1
- package/esm/index.mjs +1 -59
- package/esm/lib/FrodoLib.mjs +19 -18
- package/esm/ops/AgentOps.mjs +8 -0
- package/esm/ops/AuthenticateOps.mjs +24 -4
- package/esm/ops/CirclesOfTrustOps.mjs +18 -2
- package/esm/ops/ConnectionProfileOps.mjs +1 -105
- package/esm/ops/OAuth2OidcOps.mjs +40 -0
- package/esm/ops/ResourceTypeOps.mjs +14 -4
- package/esm/ops/ServiceOps.mjs +3 -0
- package/esm/ops/ThemeOps.mjs +7 -7
- package/esm/ops/cloud/LogOps.mjs +3 -13
- package/esm/ops/utils/Console.mjs +8 -8
- package/esm/ops/utils/ExportImportUtils.mjs +101 -0
- package/esm/ops/utils/ExportImportUtils.test.mjs +15 -2
- package/esm/ops/utils/Version.mjs +21 -4
- package/esm/ops/utils/Version.test.mjs +4 -1
- package/esm/shared/State.mjs +0 -2
- package/package.json +1 -1
- package/types/api/ApiTypes.d.ts +11 -11
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/index.d.ts +1 -48
- package/types/index.d.ts.map +1 -1
- package/types/lib/FrodoLib.d.ts +13 -9
- package/types/lib/FrodoLib.d.ts.map +1 -1
- package/types/ops/AgentOps.d.ts +5 -0
- package/types/ops/AgentOps.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts +11 -1
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/CirclesOfTrustOps.d.ts +16 -2
- package/types/ops/CirclesOfTrustOps.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts +0 -19
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/IdmOps.d.ts +1 -1
- package/types/ops/IdmOps.d.ts.map +1 -1
- package/types/ops/JourneyOps.d.ts +2 -2
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/OAuth2OidcOps.d.ts +11 -0
- package/types/ops/OAuth2OidcOps.d.ts.map +1 -0
- package/types/ops/ResourceTypeOps.d.ts +3 -3
- package/types/ops/ResourceTypeOps.d.ts.map +1 -1
- package/types/ops/ServiceOps.d.ts +1 -0
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts +14 -14
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/cloud/LogOps.d.ts +1 -1
- package/types/ops/cloud/LogOps.d.ts.map +1 -1
- package/types/ops/utils/Console.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +43 -0
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/ops/utils/Version.d.ts +16 -2
- package/types/ops/utils/Version.d.ts.map +1 -1
- package/types/shared/State.d.ts.map +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "accessToken", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _OAuth2OIDCApi.accessToken;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "authorize", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _OAuth2OIDCApi.authorize;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "clientCredentialsGrant", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _OAuth2OIDCApi.clientCredentialsGrant;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
exports.default = void 0;
|
|
25
|
+
Object.defineProperty(exports, "getTokenInfo", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _OAuth2OIDCApi.getTokenInfo;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var _OAuth2OIDCApi = require("../api/OAuth2OIDCApi");
|
|
32
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
33
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
34
|
+
class OAuth2OidcOps {
|
|
35
|
+
constructor(state) {
|
|
36
|
+
this.state = state;
|
|
37
|
+
}
|
|
38
|
+
authorize(amBaseUrl, data, config) {
|
|
39
|
+
var _this = this;
|
|
40
|
+
return _asyncToGenerator(function* () {
|
|
41
|
+
return (0, _OAuth2OIDCApi.authorize)({
|
|
42
|
+
amBaseUrl,
|
|
43
|
+
data,
|
|
44
|
+
config,
|
|
45
|
+
state: _this.state
|
|
46
|
+
});
|
|
47
|
+
})();
|
|
48
|
+
}
|
|
49
|
+
accessToken(amBaseUrl, data, config) {
|
|
50
|
+
var _this2 = this;
|
|
51
|
+
return _asyncToGenerator(function* () {
|
|
52
|
+
return (0, _OAuth2OIDCApi.accessToken)({
|
|
53
|
+
amBaseUrl,
|
|
54
|
+
config,
|
|
55
|
+
data,
|
|
56
|
+
state: _this2.state
|
|
57
|
+
});
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
getTokenInfo(amBaseUrl, config) {
|
|
61
|
+
var _this3 = this;
|
|
62
|
+
return _asyncToGenerator(function* () {
|
|
63
|
+
return (0, _OAuth2OIDCApi.getTokenInfo)({
|
|
64
|
+
amBaseUrl,
|
|
65
|
+
config,
|
|
66
|
+
state: _this3.state
|
|
67
|
+
});
|
|
68
|
+
})();
|
|
69
|
+
}
|
|
70
|
+
clientCredentialsGrant(amBaseUrl, clientId, clientSecret, scope) {
|
|
71
|
+
var _this4 = this;
|
|
72
|
+
return _asyncToGenerator(function* () {
|
|
73
|
+
return (0, _OAuth2OIDCApi.clientCredentialsGrant)({
|
|
74
|
+
amBaseUrl,
|
|
75
|
+
clientId,
|
|
76
|
+
clientSecret,
|
|
77
|
+
scope,
|
|
78
|
+
state: _this4.state
|
|
79
|
+
});
|
|
80
|
+
})();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.default = OAuth2OidcOps;
|
|
84
|
+
//# sourceMappingURL=OAuth2OidcOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth2OidcOps.js","names":["_OAuth2OIDCApi","require","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","OAuth2OidcOps","constructor","state","authorize","amBaseUrl","data","config","_this","accessToken","_this2","getTokenInfo","_this3","clientCredentialsGrant","clientId","clientSecret","scope","_this4","exports","default"],"sources":["ops/OAuth2OidcOps.ts"],"sourcesContent":["import State from '../shared/State';\nimport {\n accessToken,\n authorize,\n clientCredentialsGrant,\n getTokenInfo,\n} from '../api/OAuth2OIDCApi';\nimport { AxiosRequestConfig } from 'axios';\n\nexport {\n accessToken,\n authorize,\n clientCredentialsGrant,\n getTokenInfo,\n} from '../api/OAuth2OIDCApi';\n\nexport default class OAuth2OidcOps {\n state: State;\n constructor(state: State) {\n this.state = state;\n }\n async authorize(amBaseUrl: string, data: string, config: AxiosRequestConfig) {\n return authorize({\n amBaseUrl,\n data,\n config,\n state: this.state,\n });\n }\n\n async accessToken(amBaseUrl: string, data: any, config: AxiosRequestConfig) {\n return accessToken({ amBaseUrl, config, data, state: this.state });\n }\n\n async getTokenInfo(amBaseUrl: string, config: AxiosRequestConfig) {\n return getTokenInfo({\n amBaseUrl,\n config,\n state: this.state,\n });\n }\n\n async clientCredentialsGrant(\n amBaseUrl: string,\n clientId: string,\n clientSecret: string,\n scope: string\n ) {\n return clientCredentialsGrant({\n amBaseUrl,\n clientId,\n clientSecret,\n scope,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EACL;EAEMM,WAAWA,CAACJ,SAAiB,EAAEC,IAAS,EAAEC,MAA0B,EAAE;IAAA,IAAAG,MAAA;IAAA,OAAAjB,iBAAA;MAC1E,OAAO,IAAAgB,0BAAW,EAAC;QAAEJ,SAAS;QAAEE,MAAM;QAAED,IAAI;QAAEH,KAAK,EAAEO,MAAI,CAACP;MAAM,CAAC,CAAC;IAAC;EACrE;EAEMQ,YAAYA,CAACN,SAAiB,EAAEE,MAA0B,EAAE;IAAA,IAAAK,MAAA;IAAA,OAAAnB,iBAAA;MAChE,OAAO,IAAAkB,2BAAY,EAAC;QAClBN,SAAS;QACTE,MAAM;QACNJ,KAAK,EAAES,MAAI,CAACT;MACd,CAAC,CAAC;IAAC;EACL;EAEMU,sBAAsBA,CAC1BR,SAAiB,EACjBS,QAAgB,EAChBC,YAAoB,EACpBC,KAAa,EACb;IAAA,IAAAC,MAAA;IAAA,OAAAxB,iBAAA;MACA,OAAO,IAAAoB,qCAAsB,EAAC;QAC5BR,SAAS;QACTS,QAAQ;QACRC,YAAY;QACZC,KAAK;QACLb,KAAK,EAAEc,MAAI,CAACd;MACd,CAAC,CAAC;IAAC;EACL;AACF;AAACe,OAAA,CAAAC,OAAA,GAAAlB,aAAA"}
|
|
@@ -42,20 +42,27 @@ class ResourceTypeOps {
|
|
|
42
42
|
constructor(state) {
|
|
43
43
|
this.state = state;
|
|
44
44
|
}
|
|
45
|
+
getResourceType(resourceTypeUuid) {
|
|
46
|
+
var _this = this;
|
|
47
|
+
return _asyncToGenerator(function* () {
|
|
48
|
+
return (0, _ResourceTypesApi.getResourceType)({
|
|
49
|
+
resourceTypeUuid,
|
|
50
|
+
state: _this.state
|
|
51
|
+
});
|
|
52
|
+
})();
|
|
53
|
+
}
|
|
45
54
|
|
|
46
55
|
/**
|
|
47
56
|
* Get all resource types
|
|
48
57
|
* @returns {Promise} a promise that resolves to an array of resource type objects
|
|
49
58
|
*/
|
|
50
|
-
getResourceTypes(
|
|
59
|
+
getResourceTypes() {
|
|
60
|
+
var _this2 = this;
|
|
51
61
|
return _asyncToGenerator(function* () {
|
|
52
|
-
var {
|
|
53
|
-
state
|
|
54
|
-
} = _ref;
|
|
55
62
|
var {
|
|
56
63
|
result
|
|
57
64
|
} = yield (0, _ResourceTypesApi.getResourceTypes)({
|
|
58
|
-
state
|
|
65
|
+
state: _this2.state
|
|
59
66
|
});
|
|
60
67
|
return result;
|
|
61
68
|
})();
|
|
@@ -67,11 +74,11 @@ class ResourceTypeOps {
|
|
|
67
74
|
* @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object
|
|
68
75
|
*/
|
|
69
76
|
getResourceTypeByName(resourceTypeName) {
|
|
70
|
-
var
|
|
77
|
+
var _this3 = this;
|
|
71
78
|
return _asyncToGenerator(function* () {
|
|
72
79
|
return getResourceTypeByName({
|
|
73
80
|
resourceTypeName,
|
|
74
|
-
state:
|
|
81
|
+
state: _this3.state
|
|
75
82
|
});
|
|
76
83
|
})();
|
|
77
84
|
}
|
|
@@ -82,12 +89,21 @@ class ResourceTypeOps {
|
|
|
82
89
|
* @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object
|
|
83
90
|
*/
|
|
84
91
|
updateResourceType(resourceTypeUuid, resourceTypeData) {
|
|
85
|
-
var
|
|
92
|
+
var _this4 = this;
|
|
86
93
|
return _asyncToGenerator(function* () {
|
|
87
94
|
return updateResourceType({
|
|
88
95
|
resourceTypeUuid,
|
|
89
96
|
resourceTypeData,
|
|
90
|
-
state:
|
|
97
|
+
state: _this4.state
|
|
98
|
+
});
|
|
99
|
+
})();
|
|
100
|
+
}
|
|
101
|
+
deleteResourceType(resourceTypeUuid) {
|
|
102
|
+
var _this5 = this;
|
|
103
|
+
return _asyncToGenerator(function* () {
|
|
104
|
+
return (0, _ResourceTypesApi.deleteResourceType)({
|
|
105
|
+
resourceTypeUuid,
|
|
106
|
+
state: _this5.state
|
|
91
107
|
});
|
|
92
108
|
})();
|
|
93
109
|
}
|
|
@@ -98,11 +114,11 @@ class ResourceTypeOps {
|
|
|
98
114
|
* @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object
|
|
99
115
|
*/
|
|
100
116
|
deleteResourceTypeByName(resourceTypeName) {
|
|
101
|
-
var
|
|
117
|
+
var _this6 = this;
|
|
102
118
|
return _asyncToGenerator(function* () {
|
|
103
119
|
return deleteResourceTypeByName({
|
|
104
120
|
resourceTypeName,
|
|
105
|
-
state:
|
|
121
|
+
state: _this6.state
|
|
106
122
|
});
|
|
107
123
|
})();
|
|
108
124
|
}
|
|
@@ -113,11 +129,11 @@ class ResourceTypeOps {
|
|
|
113
129
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
114
130
|
*/
|
|
115
131
|
exportResourceType(resourceTypeUuid) {
|
|
116
|
-
var
|
|
132
|
+
var _this7 = this;
|
|
117
133
|
return _asyncToGenerator(function* () {
|
|
118
134
|
return exportResourceType({
|
|
119
135
|
resourceTypeUuid,
|
|
120
|
-
state:
|
|
136
|
+
state: _this7.state
|
|
121
137
|
});
|
|
122
138
|
})();
|
|
123
139
|
}
|
|
@@ -128,11 +144,11 @@ class ResourceTypeOps {
|
|
|
128
144
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
129
145
|
*/
|
|
130
146
|
exportResourceTypeByName(resourceTypeName) {
|
|
131
|
-
var
|
|
147
|
+
var _this8 = this;
|
|
132
148
|
return _asyncToGenerator(function* () {
|
|
133
149
|
return exportResourceTypeByName({
|
|
134
150
|
resourceTypeName,
|
|
135
|
-
state:
|
|
151
|
+
state: _this8.state
|
|
136
152
|
});
|
|
137
153
|
})();
|
|
138
154
|
}
|
|
@@ -142,10 +158,10 @@ class ResourceTypeOps {
|
|
|
142
158
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
143
159
|
*/
|
|
144
160
|
exportResourceTypes() {
|
|
145
|
-
var
|
|
161
|
+
var _this9 = this;
|
|
146
162
|
return _asyncToGenerator(function* () {
|
|
147
163
|
return exportResourceTypes({
|
|
148
|
-
state:
|
|
164
|
+
state: _this9.state
|
|
149
165
|
});
|
|
150
166
|
})();
|
|
151
167
|
}
|
|
@@ -156,12 +172,12 @@ class ResourceTypeOps {
|
|
|
156
172
|
* @param {ResourceTypeExportInterface} importData import data
|
|
157
173
|
*/
|
|
158
174
|
importResourceType(resourceTypeUuid, importData) {
|
|
159
|
-
var
|
|
175
|
+
var _this10 = this;
|
|
160
176
|
return _asyncToGenerator(function* () {
|
|
161
177
|
return importResourceType({
|
|
162
178
|
resourceTypeUuid,
|
|
163
179
|
importData,
|
|
164
|
-
state:
|
|
180
|
+
state: _this10.state
|
|
165
181
|
});
|
|
166
182
|
})();
|
|
167
183
|
}
|
|
@@ -172,12 +188,12 @@ class ResourceTypeOps {
|
|
|
172
188
|
* @param {ResourceTypeExportInterface} importData import data
|
|
173
189
|
*/
|
|
174
190
|
importResourceTypeByName(resourceTypeName, importData) {
|
|
175
|
-
var
|
|
191
|
+
var _this11 = this;
|
|
176
192
|
return _asyncToGenerator(function* () {
|
|
177
193
|
return importResourceTypeByName({
|
|
178
194
|
resourceTypeName,
|
|
179
195
|
importData,
|
|
180
|
-
state:
|
|
196
|
+
state: _this11.state
|
|
181
197
|
});
|
|
182
198
|
})();
|
|
183
199
|
}
|
|
@@ -187,11 +203,11 @@ class ResourceTypeOps {
|
|
|
187
203
|
* @param {ResourceTypeExportInterface} importData import data
|
|
188
204
|
*/
|
|
189
205
|
importFirstResourceType(importData) {
|
|
190
|
-
var
|
|
206
|
+
var _this12 = this;
|
|
191
207
|
return _asyncToGenerator(function* () {
|
|
192
208
|
return importFirstResourceType({
|
|
193
209
|
importData,
|
|
194
|
-
state:
|
|
210
|
+
state: _this12.state
|
|
195
211
|
});
|
|
196
212
|
})();
|
|
197
213
|
}
|
|
@@ -201,11 +217,11 @@ class ResourceTypeOps {
|
|
|
201
217
|
* @param {ResourceTypeExportInterface} importData import data
|
|
202
218
|
*/
|
|
203
219
|
importResourceTypes(importData) {
|
|
204
|
-
var
|
|
220
|
+
var _this13 = this;
|
|
205
221
|
return _asyncToGenerator(function* () {
|
|
206
222
|
return importResourceTypes({
|
|
207
223
|
importData,
|
|
208
|
-
state:
|
|
224
|
+
state: _this13.state
|
|
209
225
|
});
|
|
210
226
|
})();
|
|
211
227
|
}
|
|
@@ -215,10 +231,10 @@ exports.default = ResourceTypeOps;
|
|
|
215
231
|
* Create an empty export template
|
|
216
232
|
* @returns {ResourceTypeExportInterface} an empty export template
|
|
217
233
|
*/
|
|
218
|
-
function createResourceTypeExportTemplate(
|
|
234
|
+
function createResourceTypeExportTemplate(_ref) {
|
|
219
235
|
var {
|
|
220
236
|
state
|
|
221
|
-
} =
|
|
237
|
+
} = _ref;
|
|
222
238
|
return {
|
|
223
239
|
meta: (0, _ExportImportUtils.getMetadata)({
|
|
224
240
|
state
|
|
@@ -243,10 +259,10 @@ function getResourceTypes(_x) {
|
|
|
243
259
|
* @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object
|
|
244
260
|
*/
|
|
245
261
|
function _getResourceTypes2() {
|
|
246
|
-
_getResourceTypes2 = _asyncToGenerator(function* (
|
|
262
|
+
_getResourceTypes2 = _asyncToGenerator(function* (_ref2) {
|
|
247
263
|
var {
|
|
248
264
|
state
|
|
249
|
-
} =
|
|
265
|
+
} = _ref2;
|
|
250
266
|
var {
|
|
251
267
|
result
|
|
252
268
|
} = yield (0, _ResourceTypesApi.getResourceTypes)({
|
|
@@ -265,11 +281,11 @@ function getResourceTypeByName(_x2) {
|
|
|
265
281
|
* @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object
|
|
266
282
|
*/
|
|
267
283
|
function _getResourceTypeByName2() {
|
|
268
|
-
_getResourceTypeByName2 = _asyncToGenerator(function* (
|
|
284
|
+
_getResourceTypeByName2 = _asyncToGenerator(function* (_ref3) {
|
|
269
285
|
var {
|
|
270
286
|
resourceTypeName,
|
|
271
287
|
state
|
|
272
|
-
} =
|
|
288
|
+
} = _ref3;
|
|
273
289
|
var {
|
|
274
290
|
result
|
|
275
291
|
} = yield (0, _ResourceTypesApi.getResourceTypeByName)({
|
|
@@ -296,12 +312,12 @@ function updateResourceType(_x3) {
|
|
|
296
312
|
* @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object
|
|
297
313
|
*/
|
|
298
314
|
function _updateResourceType() {
|
|
299
|
-
_updateResourceType = _asyncToGenerator(function* (
|
|
315
|
+
_updateResourceType = _asyncToGenerator(function* (_ref4) {
|
|
300
316
|
var {
|
|
301
317
|
resourceTypeUuid,
|
|
302
318
|
resourceTypeData,
|
|
303
319
|
state
|
|
304
|
-
} =
|
|
320
|
+
} = _ref4;
|
|
305
321
|
return (0, _ResourceTypesApi.putResourceType)({
|
|
306
322
|
resourceTypeUuid,
|
|
307
323
|
resourceTypeData,
|
|
@@ -319,11 +335,11 @@ function deleteResourceTypeByName(_x4) {
|
|
|
319
335
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
320
336
|
*/
|
|
321
337
|
function _deleteResourceTypeByName() {
|
|
322
|
-
_deleteResourceTypeByName = _asyncToGenerator(function* (
|
|
338
|
+
_deleteResourceTypeByName = _asyncToGenerator(function* (_ref5) {
|
|
323
339
|
var {
|
|
324
340
|
resourceTypeName,
|
|
325
341
|
state
|
|
326
|
-
} =
|
|
342
|
+
} = _ref5;
|
|
327
343
|
var resourceTypeUuid = (yield getResourceTypeByName({
|
|
328
344
|
resourceTypeName,
|
|
329
345
|
state
|
|
@@ -344,11 +360,11 @@ function exportResourceType(_x5) {
|
|
|
344
360
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
345
361
|
*/
|
|
346
362
|
function _exportResourceType() {
|
|
347
|
-
_exportResourceType = _asyncToGenerator(function* (
|
|
363
|
+
_exportResourceType = _asyncToGenerator(function* (_ref6) {
|
|
348
364
|
var {
|
|
349
365
|
resourceTypeUuid,
|
|
350
366
|
state
|
|
351
|
-
} =
|
|
367
|
+
} = _ref6;
|
|
352
368
|
(0, _Console.debugMessage)("ResourceTypeOps.exportResourceType: start");
|
|
353
369
|
var exportData = createResourceTypeExportTemplate({
|
|
354
370
|
state
|
|
@@ -388,11 +404,11 @@ function exportResourceTypeByName(_x6) {
|
|
|
388
404
|
* @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object
|
|
389
405
|
*/
|
|
390
406
|
function _exportResourceTypeByName() {
|
|
391
|
-
_exportResourceTypeByName = _asyncToGenerator(function* (
|
|
407
|
+
_exportResourceTypeByName = _asyncToGenerator(function* (_ref7) {
|
|
392
408
|
var {
|
|
393
409
|
resourceTypeName,
|
|
394
410
|
state
|
|
395
|
-
} =
|
|
411
|
+
} = _ref7;
|
|
396
412
|
(0, _Console.debugMessage)("ResourceTypeOps.exportResourceTypeByName: start");
|
|
397
413
|
var exportData = createResourceTypeExportTemplate({
|
|
398
414
|
state
|
|
@@ -425,10 +441,10 @@ function exportResourceTypes(_x7) {
|
|
|
425
441
|
* @param {ResourceTypeExportInterface} importData import data
|
|
426
442
|
*/
|
|
427
443
|
function _exportResourceTypes() {
|
|
428
|
-
_exportResourceTypes = _asyncToGenerator(function* (
|
|
444
|
+
_exportResourceTypes = _asyncToGenerator(function* (_ref8) {
|
|
429
445
|
var {
|
|
430
446
|
state
|
|
431
|
-
} =
|
|
447
|
+
} = _ref8;
|
|
432
448
|
(0, _Console.debugMessage)("ResourceTypeOps.exportResourceType: start");
|
|
433
449
|
var exportData = createResourceTypeExportTemplate({
|
|
434
450
|
state
|
|
@@ -462,12 +478,12 @@ function importResourceType(_x8) {
|
|
|
462
478
|
* @param {ResourceTypeExportInterface} importData import data
|
|
463
479
|
*/
|
|
464
480
|
function _importResourceType() {
|
|
465
|
-
_importResourceType = _asyncToGenerator(function* (
|
|
481
|
+
_importResourceType = _asyncToGenerator(function* (_ref9) {
|
|
466
482
|
var {
|
|
467
483
|
resourceTypeUuid,
|
|
468
484
|
importData,
|
|
469
485
|
state
|
|
470
|
-
} =
|
|
486
|
+
} = _ref9;
|
|
471
487
|
var response = null;
|
|
472
488
|
var errors = [];
|
|
473
489
|
var imported = [];
|
|
@@ -517,12 +533,12 @@ function importResourceTypeByName(_x9) {
|
|
|
517
533
|
* @param {ResourceTypeExportInterface} importData import data
|
|
518
534
|
*/
|
|
519
535
|
function _importResourceTypeByName() {
|
|
520
|
-
_importResourceTypeByName = _asyncToGenerator(function* (
|
|
536
|
+
_importResourceTypeByName = _asyncToGenerator(function* (_ref10) {
|
|
521
537
|
var {
|
|
522
538
|
resourceTypeName,
|
|
523
539
|
importData,
|
|
524
540
|
state
|
|
525
|
-
} =
|
|
541
|
+
} = _ref10;
|
|
526
542
|
var response = null;
|
|
527
543
|
var errors = [];
|
|
528
544
|
var imported = [];
|
|
@@ -572,11 +588,11 @@ function importFirstResourceType(_x10) {
|
|
|
572
588
|
* @param {ResourceTypeExportInterface} importData import data
|
|
573
589
|
*/
|
|
574
590
|
function _importFirstResourceType() {
|
|
575
|
-
_importFirstResourceType = _asyncToGenerator(function* (
|
|
591
|
+
_importFirstResourceType = _asyncToGenerator(function* (_ref11) {
|
|
576
592
|
var {
|
|
577
593
|
importData,
|
|
578
594
|
state
|
|
579
|
-
} =
|
|
595
|
+
} = _ref11;
|
|
580
596
|
var response = null;
|
|
581
597
|
var errors = [];
|
|
582
598
|
var imported = [];
|
|
@@ -622,11 +638,11 @@ function importResourceTypes(_x11) {
|
|
|
622
638
|
return _importResourceTypes.apply(this, arguments);
|
|
623
639
|
}
|
|
624
640
|
function _importResourceTypes() {
|
|
625
|
-
_importResourceTypes = _asyncToGenerator(function* (
|
|
641
|
+
_importResourceTypes = _asyncToGenerator(function* (_ref12) {
|
|
626
642
|
var {
|
|
627
643
|
importData,
|
|
628
644
|
state
|
|
629
|
-
} =
|
|
645
|
+
} = _ref12;
|
|
630
646
|
var response = [];
|
|
631
647
|
var errors = [];
|
|
632
648
|
var imported = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTypeOps.js","names":["_ResourceTypesApi","require","_ExportImportUtils","_Console","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","ResourceTypeOps","constructor","state","getResourceTypes","_ref","result","_getResourceTypes","getResourceTypeByName","resourceTypeName","_this","updateResourceType","resourceTypeUuid","resourceTypeData","_this2","deleteResourceTypeByName","_this3","exportResourceType","_this4","exportResourceTypeByName","_this5","exportResourceTypes","_this6","importResourceType","importData","_this7","importResourceTypeByName","_this8","importFirstResourceType","_this9","importResourceTypes","_this10","exports","default","createResourceTypeExportTemplate","_ref2","meta","getMetadata","script","policy","policyset","resourcetype","_x","_getResourceTypes2","_ref3","_x2","_getResourceTypeByName2","_ref4","_getResourceTypeByName","length","Error","concat","getRealm","_x3","_updateResourceType","_ref5","putResourceType","_x4","_deleteResourceTypeByName","_ref6","uuid","deleteResourceType","_x5","_exportResourceType","_ref7","debugMessage","exportData","errors","getResourceType","push","errorMessages","map","_error$response","response","status","_error$response2","_error$response2$data","data","message","join","_x6","_exportResourceTypeByName","_ref8","_x7","_exportResourceTypes","_ref9","resourceTypes","_x8","_importResourceType","_ref10","imported","id","Object","keys","_rev","createResourceType","createError","_createError$response","_error$response3","_error$response3$data","_x9","_importResourceTypeByName","_ref11","name","_createError$response2","_error$response4","_error$response4$data","_x10","_importFirstResourceType","_ref12","_provider","_createError$response3","_error$response5","_error$response5$data","_x11","_importResourceTypes","_ref13","_createError$response4","_error$response6","_error$response6$data"],"sources":["ops/ResourceTypeOps.ts"],"sourcesContent":["import {\n deleteResourceType,\n getResourceTypes as _getResourceTypes,\n getResourceType,\n getResourceTypeByName as _getResourceTypeByName,\n createResourceType,\n putResourceType,\n} from '../api/ResourceTypesApi';\nimport { ExportMetaData } from './OpsTypes';\nimport { ResourceTypeSkeleton } from '../api/ApiTypes';\nimport { getMetadata } from './utils/ExportImportUtils';\nimport { debugMessage } from './utils/Console';\nimport State from '../shared/State';\n\nexport default class ResourceTypeOps {\n state: State;\n constructor(state: State) {\n this.state = state;\n }\n\n /**\n * Get all resource types\n * @returns {Promise} a promise that resolves to an array of resource type objects\n */\n async getResourceTypes({\n state,\n }: {\n state: State;\n }): Promise<ResourceTypeSkeleton[]> {\n const { result } = await _getResourceTypes({ state });\n return result;\n }\n\n /**\n * Get resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\n async getResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeSkeleton> {\n return getResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Update resource type\n * @param {string} resourceTypeData resource type id\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\n async updateResourceType(\n resourceTypeUuid: string,\n resourceTypeData: ResourceTypeSkeleton\n ): Promise<ResourceTypeSkeleton> {\n return updateResourceType({\n resourceTypeUuid,\n resourceTypeData,\n state: this.state,\n });\n }\n\n /**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object\n */\n async deleteResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeSkeleton> {\n return deleteResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Export resource type\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceType(\n resourceTypeUuid: string\n ): Promise<ResourceTypeExportInterface> {\n return exportResourceType({ resourceTypeUuid, state: this.state });\n }\n\n /**\n * Export resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeExportInterface> {\n return exportResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Export resource types\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceTypes(): Promise<ResourceTypeExportInterface> {\n return exportResourceTypes({ state: this.state });\n }\n\n /**\n * Import resource type by uuid\n * @param {string} resourceTypeUuid client uuid\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceType(\n resourceTypeUuid: string,\n importData: ResourceTypeExportInterface\n ) {\n return importResourceType({\n resourceTypeUuid,\n importData,\n state: this.state,\n });\n }\n\n /**\n * Import resource type by name\n * @param {string} resourceTypeName client id\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceTypeByName(\n resourceTypeName: string,\n importData: ResourceTypeExportInterface\n ) {\n return importResourceTypeByName({\n resourceTypeName,\n importData,\n state: this.state,\n });\n }\n\n /**\n * Import first resource type\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importFirstResourceType(importData: ResourceTypeExportInterface) {\n return importFirstResourceType({ importData, state: this.state });\n }\n\n /**\n * Import resource types\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceTypes(importData: ResourceTypeExportInterface) {\n return importResourceTypes({ importData, state: this.state });\n }\n}\n\nexport interface ResourceTypeExportInterface {\n meta?: ExportMetaData;\n resourcetype: Record<string, ResourceTypeSkeleton>;\n}\n\n/**\n * Create an empty export template\n * @returns {ResourceTypeExportInterface} an empty export template\n */\nfunction createResourceTypeExportTemplate({\n state,\n}: {\n state: State;\n}): ResourceTypeExportInterface {\n return {\n meta: getMetadata({ state }),\n script: {},\n policy: {},\n policyset: {},\n resourcetype: {},\n } as ResourceTypeExportInterface;\n}\n\n/**\n * Get all resource types\n * @returns {Promise} a promise that resolves to an array of resource type objects\n */\nexport async function getResourceTypes({\n state,\n}: {\n state: State;\n}): Promise<ResourceTypeSkeleton[]> {\n const { result } = await _getResourceTypes({ state });\n return result;\n}\n\n/**\n * Get resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\nexport async function getResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n const { result } = await _getResourceTypeByName({ resourceTypeName, state });\n switch (result.length) {\n case 1:\n return result[0];\n case 0:\n throw new Error(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`\n );\n default:\n throw new Error(\n `${result.length} resource types '${resourceTypeName}' found`\n );\n }\n}\n\n/**\n * Update resource type\n * @param {string} resourceTypeData resource type id\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\nexport async function updateResourceType({\n resourceTypeUuid,\n resourceTypeData,\n state,\n}: {\n resourceTypeUuid: string;\n resourceTypeData: ResourceTypeSkeleton;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n return putResourceType({ resourceTypeUuid, resourceTypeData, state });\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object\n */\nexport async function deleteResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n const resourceTypeUuid = (\n await getResourceTypeByName({ resourceTypeName, state })\n ).uuid;\n return deleteResourceType({ resourceTypeUuid, state });\n}\n\n/**\n * Export resource type\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceType({\n resourceTypeUuid,\n state,\n}: {\n resourceTypeUuid: string;\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceType: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypeData = await getResourceType({\n resourceTypeUuid,\n state,\n });\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => {\n if (error.response?.status === 404) {\n return `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`;\n } else {\n return error.response?.data?.message || error.message;\n }\n })\n .join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceType: end`);\n return exportData;\n}\n\n/**\n * Export resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceTypeByName: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypeData = await getResourceTypeByName({\n resourceTypeName,\n state,\n });\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceTypeByName: end`);\n return exportData;\n}\n\n/**\n * Export resource types\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceTypes({\n state,\n}: {\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceType: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypes = await getResourceTypes({ state });\n for (const resourceTypeData of resourceTypes) {\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n }\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceType: end`);\n return exportData;\n}\n\n/**\n * Import resource type by uuid\n * @param {string} resourceTypeUuid client uuid\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceType({\n resourceTypeUuid,\n importData,\n state,\n}: {\n resourceTypeUuid: string;\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n if (id === resourceTypeUuid) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(\n `Import error:\\n${resourceTypeUuid} not found in import data!`\n );\n }\n return response;\n}\n\n/**\n * Import resource type by name\n * @param {string} resourceTypeName client id\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceTypeByName({\n resourceTypeName,\n importData,\n state,\n}: {\n resourceTypeName: string;\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n if (importData.resourcetype[id].name === resourceTypeName) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(\n `Import error:\\n${resourceTypeName} not found in import data!`\n );\n }\n return response;\n}\n\n/**\n * Import first resource type\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importFirstResourceType({\n importData,\n state,\n}: {\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._provider;\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n break;\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(`Import error:\\nNo resource types found in import data!`);\n }\n return response;\n}\n\n/**\n * Import resource types\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceTypes({\n importData,\n state,\n}: {\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n const response = [];\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response.push(await createResourceType({ resourceTypeData, state }));\n } catch (createError) {\n if (createError.response?.status === 409)\n response.push(\n await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n })\n );\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(`Import error:\\nNo resource types found in import data!`);\n }\n return response;\n}\n\nexport { getResourceType, createResourceType, deleteResourceType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,CAAC,CAAC,KACC,MAAM6F,WAAW;QACxB;QACAN,QAAQ,CAACrB,IAAI,CAACsB,EAAE,CAAC;MACnB,CAAC,CAAC,OAAOtG,KAAK,EAAE;QACd8E,MAAM,CAACE,IAAI,CAAChF,KAAK,CAAC;MACpB;IACF;IACA,IAAI8E,MAAM,CAAClB,MAAM,EAAE;MACjB,IAAMqB,aAAa,GAAGH,MAAM,CACzBI,GAAG,CAAElF,KAAK;QAAA,IAAAiI,gBAAA,EAAAC,qBAAA;QAAA,OAAK,EAAAD,gBAAA,GAAAjI,KAAK,CAACoF,QAAQ,cAAA6C,gBAAA,wBAAAC,qBAAA,GAAdD,gBAAA,CAAgBzC,IAAI,cAAA0C,qBAAA,uBAApBA,qBAAA,CAAsBzC,OAAO,KAAIzF,KAAK,CAACyF,OAAO;MAAA,EAAC,CAC9DC,IAAI,CAAC,IAAI,CAAC;MACb,MAAM,IAAI7B,KAAK,mBAAAC,MAAA,CAAmBmB,aAAa,CAAE,CAAC;IACpD;IACA,IAAI,CAAC,KAAKoB,QAAQ,CAACzC,MAAM,EAAE;MACzB,MAAM,IAAIC,KAAK,yDAAyD,CAAC;IAC3E;IACA,OAAOuB,QAAQ;EACjB,CAAC;EAAA,OAAA0C,oBAAA,CAAArH,KAAA,OAAAD,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"ResourceTypeOps.js","names":["_ResourceTypesApi","require","_ExportImportUtils","_Console","asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","ResourceTypeOps","constructor","state","getResourceType","resourceTypeUuid","_this","getResourceTypes","_this2","result","_getResourceTypes","getResourceTypeByName","resourceTypeName","_this3","updateResourceType","resourceTypeData","_this4","deleteResourceType","_this5","deleteResourceTypeByName","_this6","exportResourceType","_this7","exportResourceTypeByName","_this8","exportResourceTypes","_this9","importResourceType","importData","_this10","importResourceTypeByName","_this11","importFirstResourceType","_this12","importResourceTypes","_this13","exports","default","createResourceTypeExportTemplate","_ref","meta","getMetadata","script","policy","policyset","resourcetype","_x","_getResourceTypes2","_ref2","_x2","_getResourceTypeByName2","_ref3","_getResourceTypeByName","length","Error","concat","getRealm","_x3","_updateResourceType","_ref4","putResourceType","_x4","_deleteResourceTypeByName","_ref5","uuid","_x5","_exportResourceType","_ref6","debugMessage","exportData","errors","push","errorMessages","map","_error$response","response","status","_error$response2","_error$response2$data","data","message","join","_x6","_exportResourceTypeByName","_ref7","_x7","_exportResourceTypes","_ref8","resourceTypes","_x8","_importResourceType","_ref9","imported","id","Object","keys","_rev","createResourceType","createError","_createError$response","_error$response3","_error$response3$data","_x9","_importResourceTypeByName","_ref10","name","_createError$response2","_error$response4","_error$response4$data","_x10","_importFirstResourceType","_ref11","_provider","_createError$response3","_error$response5","_error$response5$data","_x11","_importResourceTypes","_ref12","_createError$response4","_error$response6","_error$response6$data"],"sources":["ops/ResourceTypeOps.ts"],"sourcesContent":["import {\n deleteResourceType,\n getResourceTypes as _getResourceTypes,\n getResourceType,\n getResourceTypeByName as _getResourceTypeByName,\n createResourceType,\n putResourceType,\n} from '../api/ResourceTypesApi';\nimport { ExportMetaData } from './OpsTypes';\nimport { ResourceTypeSkeleton } from '../api/ApiTypes';\nimport { getMetadata } from './utils/ExportImportUtils';\nimport { debugMessage } from './utils/Console';\nimport State from '../shared/State';\n\nexport default class ResourceTypeOps {\n state: State;\n constructor(state: State) {\n this.state = state;\n }\n\n async getResourceType(resourceTypeUuid: string) {\n return getResourceType({ resourceTypeUuid, state: this.state });\n }\n\n /**\n * Get all resource types\n * @returns {Promise} a promise that resolves to an array of resource type objects\n */\n async getResourceTypes(): Promise<ResourceTypeSkeleton[]> {\n const { result } = await _getResourceTypes({ state: this.state });\n return result;\n }\n\n /**\n * Get resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\n async getResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeSkeleton> {\n return getResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Update resource type\n * @param {string} resourceTypeData resource type id\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\n async updateResourceType(\n resourceTypeUuid: string,\n resourceTypeData: ResourceTypeSkeleton\n ): Promise<ResourceTypeSkeleton> {\n return updateResourceType({\n resourceTypeUuid,\n resourceTypeData,\n state: this.state,\n });\n }\n\n async deleteResourceType(resourceTypeUuid: string) {\n return deleteResourceType({ resourceTypeUuid, state: this.state });\n }\n\n /**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object\n */\n async deleteResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeSkeleton> {\n return deleteResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Export resource type\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceType(\n resourceTypeUuid: string\n ): Promise<ResourceTypeExportInterface> {\n return exportResourceType({ resourceTypeUuid, state: this.state });\n }\n\n /**\n * Export resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceTypeByName(\n resourceTypeName: string\n ): Promise<ResourceTypeExportInterface> {\n return exportResourceTypeByName({ resourceTypeName, state: this.state });\n }\n\n /**\n * Export resource types\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\n async exportResourceTypes(): Promise<ResourceTypeExportInterface> {\n return exportResourceTypes({ state: this.state });\n }\n\n /**\n * Import resource type by uuid\n * @param {string} resourceTypeUuid client uuid\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceType(\n resourceTypeUuid: string,\n importData: ResourceTypeExportInterface\n ) {\n return importResourceType({\n resourceTypeUuid,\n importData,\n state: this.state,\n });\n }\n\n /**\n * Import resource type by name\n * @param {string} resourceTypeName client id\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceTypeByName(\n resourceTypeName: string,\n importData: ResourceTypeExportInterface\n ) {\n return importResourceTypeByName({\n resourceTypeName,\n importData,\n state: this.state,\n });\n }\n\n /**\n * Import first resource type\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importFirstResourceType(importData: ResourceTypeExportInterface) {\n return importFirstResourceType({ importData, state: this.state });\n }\n\n /**\n * Import resource types\n * @param {ResourceTypeExportInterface} importData import data\n */\n async importResourceTypes(importData: ResourceTypeExportInterface) {\n return importResourceTypes({ importData, state: this.state });\n }\n}\n\nexport interface ResourceTypeExportInterface {\n meta?: ExportMetaData;\n resourcetype: Record<string, ResourceTypeSkeleton>;\n}\n\n/**\n * Create an empty export template\n * @returns {ResourceTypeExportInterface} an empty export template\n */\nfunction createResourceTypeExportTemplate({\n state,\n}: {\n state: State;\n}): ResourceTypeExportInterface {\n return {\n meta: getMetadata({ state }),\n script: {},\n policy: {},\n policyset: {},\n resourcetype: {},\n } as ResourceTypeExportInterface;\n}\n\n/**\n * Get all resource types\n * @returns {Promise} a promise that resolves to an array of resource type objects\n */\nexport async function getResourceTypes({\n state,\n}: {\n state: State;\n}): Promise<ResourceTypeSkeleton[]> {\n const { result } = await _getResourceTypes({ state });\n return result;\n}\n\n/**\n * Get resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\nexport async function getResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n const { result } = await _getResourceTypeByName({ resourceTypeName, state });\n switch (result.length) {\n case 1:\n return result[0];\n case 0:\n throw new Error(\n `Resource Type with name ${resourceTypeName} does not exist in realm ${state.getRealm()}`\n );\n default:\n throw new Error(\n `${result.length} resource types '${resourceTypeName}' found`\n );\n }\n}\n\n/**\n * Update resource type\n * @param {string} resourceTypeData resource type id\n * @returns {Promise<ResourceTypeSkeleton>} a promise that resolves to a resource type object\n */\nexport async function updateResourceType({\n resourceTypeUuid,\n resourceTypeData,\n state,\n}: {\n resourceTypeUuid: string;\n resourceTypeData: ResourceTypeSkeleton;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n return putResourceType({ resourceTypeUuid, resourceTypeData, state });\n}\n\n/**\n * Delete resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeSkeleton>} Promise resolvig to a resource type object\n */\nexport async function deleteResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeSkeleton> {\n const resourceTypeUuid = (\n await getResourceTypeByName({ resourceTypeName, state })\n ).uuid;\n return deleteResourceType({ resourceTypeUuid, state });\n}\n\n/**\n * Export resource type\n * @param {string} resourceTypeUuid resource type uuid\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceType({\n resourceTypeUuid,\n state,\n}: {\n resourceTypeUuid: string;\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceType: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypeData = await getResourceType({\n resourceTypeUuid,\n state,\n });\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => {\n if (error.response?.status === 404) {\n return `Resource Type with uuid ${resourceTypeUuid} does not exist in realm ${state.getRealm()}`;\n } else {\n return error.response?.data?.message || error.message;\n }\n })\n .join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceType: end`);\n return exportData;\n}\n\n/**\n * Export resource type by name\n * @param {string} resourceTypeName resource type name\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceTypeByName({\n resourceTypeName,\n state,\n}: {\n resourceTypeName: string;\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceTypeByName: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypeData = await getResourceTypeByName({\n resourceTypeName,\n state,\n });\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceTypeByName: end`);\n return exportData;\n}\n\n/**\n * Export resource types\n * @returns {Promise<ResourceTypeExportInterface>} a promise that resolves to an ResourceTypeExportInterface object\n */\nexport async function exportResourceTypes({\n state,\n}: {\n state: State;\n}): Promise<ResourceTypeExportInterface> {\n debugMessage(`ResourceTypeOps.exportResourceType: start`);\n const exportData = createResourceTypeExportTemplate({ state });\n const errors = [];\n try {\n const resourceTypes = await getResourceTypes({ state });\n for (const resourceTypeData of resourceTypes) {\n exportData.resourcetype[resourceTypeData.uuid] = resourceTypeData;\n }\n } catch (error) {\n errors.push(error);\n }\n if (errors.length) {\n const errorMessages = errors.map((error) => error.message).join('\\n');\n throw new Error(`Export error:\\n${errorMessages}`);\n }\n debugMessage(`ResourceTypeOps.exportResourceType: end`);\n return exportData;\n}\n\n/**\n * Import resource type by uuid\n * @param {string} resourceTypeUuid client uuid\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceType({\n resourceTypeUuid,\n importData,\n state,\n}: {\n resourceTypeUuid: string;\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n if (id === resourceTypeUuid) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(\n `Import error:\\n${resourceTypeUuid} not found in import data!`\n );\n }\n return response;\n}\n\n/**\n * Import resource type by name\n * @param {string} resourceTypeName client id\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceTypeByName({\n resourceTypeName,\n importData,\n state,\n}: {\n resourceTypeName: string;\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n if (importData.resourcetype[id].name === resourceTypeName) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(\n `Import error:\\n${resourceTypeName} not found in import data!`\n );\n }\n return response;\n}\n\n/**\n * Import first resource type\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importFirstResourceType({\n importData,\n state,\n}: {\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n let response = null;\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._provider;\n delete resourceTypeData._rev;\n try {\n response = await createResourceType({ resourceTypeData, state });\n } catch (createError) {\n if (createError.response?.status === 409)\n response = await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n });\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n break;\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(`Import error:\\nNo resource types found in import data!`);\n }\n return response;\n}\n\n/**\n * Import resource types\n * @param {ResourceTypeExportInterface} importData import data\n */\nexport async function importResourceTypes({\n importData,\n state,\n}: {\n importData: ResourceTypeExportInterface;\n state: State;\n}) {\n const response = [];\n const errors = [];\n const imported = [];\n for (const id of Object.keys(importData.resourcetype)) {\n try {\n const resourceTypeData = importData.resourcetype[id];\n delete resourceTypeData._rev;\n try {\n response.push(await createResourceType({ resourceTypeData, state }));\n } catch (createError) {\n if (createError.response?.status === 409)\n response.push(\n await putResourceType({\n resourceTypeUuid: id,\n resourceTypeData,\n state,\n })\n );\n else throw createError;\n }\n imported.push(id);\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length) {\n const errorMessages = errors\n .map((error) => error.response?.data?.message || error.message)\n .join('\\n');\n throw new Error(`Import error:\\n${errorMessages}`);\n }\n if (0 === imported.length) {\n throw new Error(`Import error:\\nNo resource types found in import data!`);\n }\n return response;\n}\n\nexport { getResourceType, createResourceType, deleteResourceType };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAUA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAA+C,SAAAG,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,GAAA,EAAAC,GAAA,cAAAC,IAAA,GAAAP,GAAA,CAAAK,GAAA,EAAAC,GAAA,OAAAE,KAAA,GAAAD,IAAA,CAAAC,KAAA,WAAAC,KAAA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