@tapis/tapis-typescript-systems 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/.openapi-generator/FILES +3 -0
  2. package/.openapi-generator/VERSION +1 -1
  3. package/README.md +5 -4
  4. package/dist/apis/ChildSystemsApi.d.ts +10 -10
  5. package/dist/apis/ChildSystemsApi.js +84 -65
  6. package/dist/apis/CredentialsApi.d.ts +25 -24
  7. package/dist/apis/CredentialsApi.js +172 -138
  8. package/dist/apis/GeneralApi.d.ts +6 -6
  9. package/dist/apis/GeneralApi.js +18 -11
  10. package/dist/apis/PermissionsApi.d.ts +10 -10
  11. package/dist/apis/PermissionsApi.js +112 -89
  12. package/dist/apis/SchedulerProfilesApi.d.ts +10 -10
  13. package/dist/apis/SchedulerProfilesApi.js +95 -72
  14. package/dist/apis/SharingApi.d.ts +12 -12
  15. package/dist/apis/SharingApi.js +122 -95
  16. package/dist/apis/SystemsApi.d.ts +61 -46
  17. package/dist/apis/SystemsApi.js +473 -341
  18. package/dist/apis/index.js +21 -10
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +17 -6
  21. package/dist/models/AuthnEnum.d.ts +12 -9
  22. package/dist/models/AuthnEnum.js +28 -13
  23. package/dist/models/Capability.d.ts +9 -3
  24. package/dist/models/Capability.js +37 -22
  25. package/dist/models/CategoryEnum.d.ts +14 -12
  26. package/dist/models/CategoryEnum.js +30 -16
  27. package/dist/models/Credential.d.ts +26 -3
  28. package/dist/models/Credential.js +47 -33
  29. package/dist/models/DatatypeEnum.d.ts +11 -9
  30. package/dist/models/DatatypeEnum.js +27 -13
  31. package/dist/models/JobRuntime.d.ts +8 -3
  32. package/dist/models/JobRuntime.js +27 -17
  33. package/dist/models/KeyValueInputModeEnum.d.ts +10 -8
  34. package/dist/models/KeyValueInputModeEnum.js +26 -12
  35. package/dist/models/KeyValuePair.d.ts +8 -3
  36. package/dist/models/KeyValuePair.js +32 -22
  37. package/dist/models/ListTypeEnum.d.ts +9 -7
  38. package/dist/models/ListTypeEnum.js +25 -11
  39. package/dist/models/LogicalQueue.d.ts +13 -2
  40. package/dist/models/LogicalQueue.js +48 -34
  41. package/dist/models/ModuleLoadSpec.d.ts +7 -2
  42. package/dist/models/ModuleLoadSpec.js +25 -15
  43. package/dist/models/OperationTypeEnum.d.ts +20 -18
  44. package/dist/models/OperationTypeEnum.js +36 -22
  45. package/dist/models/ReqMatchConstraints.d.ts +7 -2
  46. package/dist/models/ReqMatchConstraints.js +23 -12
  47. package/dist/models/ReqPatchSystem.d.ts +13 -3
  48. package/dist/models/ReqPatchSystem.js +76 -63
  49. package/dist/models/ReqPerms.d.ts +7 -2
  50. package/dist/models/ReqPerms.js +23 -12
  51. package/dist/models/ReqPostChildSystem.d.ts +7 -2
  52. package/dist/models/ReqPostChildSystem.js +28 -16
  53. package/dist/models/ReqPostPutCredential.d.ts +7 -2
  54. package/dist/models/ReqPostPutCredential.js +36 -28
  55. package/dist/models/ReqPostSchedulerProfile.d.ts +9 -3
  56. package/dist/models/ReqPostSchedulerProfile.js +33 -22
  57. package/dist/models/ReqPostSystem.d.ts +15 -3
  58. package/dist/models/ReqPostSystem.js +101 -76
  59. package/dist/models/ReqPutSystem.d.ts +13 -3
  60. package/dist/models/ReqPutSystem.js +74 -61
  61. package/dist/models/ReqSearchSystems.d.ts +7 -2
  62. package/dist/models/ReqSearchSystems.js +23 -12
  63. package/dist/models/ReqShareUpdate.d.ts +7 -2
  64. package/dist/models/ReqShareUpdate.js +23 -12
  65. package/dist/models/ReqUnlinkChildren.d.ts +7 -2
  66. package/dist/models/ReqUnlinkChildren.js +22 -14
  67. package/dist/models/ReqUpdateCredential.d.ts +7 -2
  68. package/dist/models/ReqUpdateCredential.js +38 -30
  69. package/dist/models/RespBasic.d.ts +7 -2
  70. package/dist/models/RespBasic.js +34 -26
  71. package/dist/models/RespBoolean.d.ts +8 -3
  72. package/dist/models/RespBoolean.js +35 -27
  73. package/dist/models/RespChangeCount.d.ts +8 -3
  74. package/dist/models/RespChangeCount.js +35 -27
  75. package/dist/models/RespCredential.d.ts +8 -3
  76. package/dist/models/RespCredential.js +35 -27
  77. package/dist/models/RespGlobusAuthUrl.d.ts +8 -3
  78. package/dist/models/RespGlobusAuthUrl.js +35 -27
  79. package/dist/models/RespName.d.ts +69 -0
  80. package/dist/models/RespName.js +62 -0
  81. package/dist/models/RespNameArray.d.ts +8 -3
  82. package/dist/models/RespNameArray.js +35 -27
  83. package/dist/models/RespResourceUrl.d.ts +8 -3
  84. package/dist/models/RespResourceUrl.js +35 -27
  85. package/dist/models/RespSchedulerProfile.d.ts +8 -3
  86. package/dist/models/RespSchedulerProfile.js +35 -27
  87. package/dist/models/RespSchedulerProfiles.d.ts +8 -3
  88. package/dist/models/RespSchedulerProfiles.js +35 -27
  89. package/dist/models/RespShareInfo.d.ts +8 -3
  90. package/dist/models/RespShareInfo.js +35 -27
  91. package/dist/models/RespSystem.d.ts +8 -3
  92. package/dist/models/RespSystem.js +35 -27
  93. package/dist/models/RespSystemHistory.d.ts +8 -3
  94. package/dist/models/RespSystemHistory.js +35 -27
  95. package/dist/models/RespSystems.d.ts +9 -3
  96. package/dist/models/RespSystems.js +36 -27
  97. package/dist/models/RespSystemsMetadata.d.ts +7 -2
  98. package/dist/models/RespSystemsMetadata.js +32 -24
  99. package/dist/models/ResultBoolean.d.ts +7 -2
  100. package/dist/models/ResultBoolean.js +22 -14
  101. package/dist/models/ResultChangeCount.d.ts +7 -2
  102. package/dist/models/ResultChangeCount.js +22 -14
  103. package/dist/models/ResultGlobusAuthUrl.d.ts +7 -2
  104. package/dist/models/ResultGlobusAuthUrl.js +26 -18
  105. package/dist/models/ResultName.d.ts +32 -0
  106. package/dist/models/ResultName.js +49 -0
  107. package/dist/models/ResultNameArray.d.ts +7 -2
  108. package/dist/models/ResultNameArray.js +22 -14
  109. package/dist/models/ResultResourceUrl.d.ts +7 -2
  110. package/dist/models/ResultResourceUrl.js +22 -14
  111. package/dist/models/RuntimeTypeEnum.d.ts +9 -7
  112. package/dist/models/RuntimeTypeEnum.js +25 -11
  113. package/dist/models/SchedulerHiddenOptionEnum.d.ts +8 -5
  114. package/dist/models/SchedulerHiddenOptionEnum.js +24 -9
  115. package/dist/models/SchedulerProfile.d.ts +9 -3
  116. package/dist/models/SchedulerProfile.js +35 -24
  117. package/dist/models/SchedulerTypeEnum.d.ts +12 -10
  118. package/dist/models/SchedulerTypeEnum.js +28 -14
  119. package/dist/models/ShareInfo.d.ts +14 -2
  120. package/dist/models/ShareInfo.js +29 -13
  121. package/dist/models/SkShareRecord.d.ts +86 -0
  122. package/dist/models/SkShareRecord.js +67 -0
  123. package/dist/models/SystemHistory.d.ts +8 -3
  124. package/dist/models/SystemHistory.js +35 -27
  125. package/dist/models/SystemTypeEnum.d.ts +10 -8
  126. package/dist/models/SystemTypeEnum.js +26 -12
  127. package/dist/models/TapisSystem.d.ts +45 -21
  128. package/dist/models/TapisSystem.js +114 -95
  129. package/dist/models/index.d.ts +3 -0
  130. package/dist/models/index.js +68 -54
  131. package/dist/runtime.d.ts +79 -37
  132. package/dist/runtime.js +311 -169
  133. package/package.json +6 -2
  134. package/src/apis/ChildSystemsApi.ts +47 -33
  135. package/src/apis/CredentialsApi.ts +124 -75
  136. package/src/apis/GeneralApi.ts +9 -7
  137. package/src/apis/PermissionsApi.ts +80 -45
  138. package/src/apis/SchedulerProfilesApi.ts +40 -29
  139. package/src/apis/SharingApi.ts +64 -41
  140. package/src/apis/SystemsApi.ts +306 -189
  141. package/src/index.ts +2 -2
  142. package/src/models/AuthnEnum.ts +26 -8
  143. package/src/models/Capability.ts +37 -19
  144. package/src/models/CategoryEnum.ts +28 -11
  145. package/src/models/Credential.ts +67 -31
  146. package/src/models/DatatypeEnum.ts +25 -8
  147. package/src/models/JobRuntime.ts +27 -14
  148. package/src/models/KeyValueInputModeEnum.ts +24 -7
  149. package/src/models/KeyValuePair.ts +33 -20
  150. package/src/models/ListTypeEnum.ts +23 -6
  151. package/src/models/LogicalQueue.ts +50 -31
  152. package/src/models/ModuleLoadSpec.ts +22 -12
  153. package/src/models/OperationTypeEnum.ts +34 -17
  154. package/src/models/ReqMatchConstraints.ts +20 -10
  155. package/src/models/ReqPatchSystem.ts +96 -69
  156. package/src/models/ReqPerms.ts +20 -10
  157. package/src/models/ReqPostChildSystem.ts +24 -13
  158. package/src/models/ReqPostPutCredential.ts +34 -25
  159. package/src/models/ReqPostSchedulerProfile.ts +38 -24
  160. package/src/models/ReqPostSystem.ts +123 -85
  161. package/src/models/ReqPutSystem.ts +94 -67
  162. package/src/models/ReqSearchSystems.ts +20 -10
  163. package/src/models/ReqShareUpdate.ts +20 -10
  164. package/src/models/ReqUnlinkChildren.ts +20 -11
  165. package/src/models/ReqUpdateCredential.ts +36 -27
  166. package/src/models/RespBasic.ts +32 -23
  167. package/src/models/RespBoolean.ts +35 -25
  168. package/src/models/RespChangeCount.ts +35 -25
  169. package/src/models/RespCredential.ts +35 -25
  170. package/src/models/RespGlobusAuthUrl.ts +35 -25
  171. package/src/models/RespName.ts +121 -0
  172. package/src/models/RespNameArray.ts +35 -25
  173. package/src/models/RespResourceUrl.ts +35 -25
  174. package/src/models/RespSchedulerProfile.ts +35 -25
  175. package/src/models/RespSchedulerProfiles.ts +35 -25
  176. package/src/models/RespShareInfo.ts +35 -25
  177. package/src/models/RespSystem.ts +35 -25
  178. package/src/models/RespSystemHistory.ts +35 -25
  179. package/src/models/RespSystems.ts +42 -29
  180. package/src/models/RespSystemsMetadata.ts +30 -21
  181. package/src/models/ResultBoolean.ts +20 -11
  182. package/src/models/ResultChangeCount.ts +20 -11
  183. package/src/models/ResultGlobusAuthUrl.ts +24 -15
  184. package/src/models/ResultName.ts +65 -0
  185. package/src/models/ResultNameArray.ts +20 -11
  186. package/src/models/ResultResourceUrl.ts +20 -11
  187. package/src/models/RuntimeTypeEnum.ts +23 -6
  188. package/src/models/SchedulerHiddenOptionEnum.ts +22 -4
  189. package/src/models/SchedulerProfile.ts +40 -26
  190. package/src/models/SchedulerTypeEnum.ts +26 -9
  191. package/src/models/ShareInfo.ts +38 -11
  192. package/src/models/SkShareRecord.ts +137 -0
  193. package/src/models/SystemHistory.ts +37 -25
  194. package/src/models/SystemTypeEnum.ts +24 -7
  195. package/src/models/TapisSystem.ts +173 -124
  196. package/src/models/index.ts +3 -0
  197. package/src/runtime.ts +217 -106
package/dist/runtime.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Tapis Systems API
6
6
  * The Tapis Systems API provides for management of Tapis Systems including permissions, credentials and Scheduler Profiles.
7
7
  *
8
- * The version of the OpenAPI document: 1.7.0
8
+ * The version of the OpenAPI document: 25Q4.2
9
9
  * Contact: cicsupport@tacc.utexas.edu
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -13,38 +13,47 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  var __extends = (this && this.__extends) || (function () {
16
- var extendStatics = Object.setPrototypeOf ||
17
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
18
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16
+ var extendStatics = function (d, b) {
17
+ extendStatics = Object.setPrototypeOf ||
18
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
+ return extendStatics(d, b);
21
+ };
19
22
  return function (d, b) {
23
+ if (typeof b !== "function" && b !== null)
24
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
20
25
  extendStatics(d, b);
21
26
  function __() { this.constructor = d; }
22
27
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23
28
  };
24
29
  })();
25
- var __assign = (this && this.__assign) || Object.assign || function(t) {
26
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27
- s = arguments[i];
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29
- t[p] = s[p];
30
- }
31
- return t;
30
+ var __assign = (this && this.__assign) || function () {
31
+ __assign = Object.assign || function(t) {
32
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
33
+ s = arguments[i];
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
+ t[p] = s[p];
36
+ }
37
+ return t;
38
+ };
39
+ return __assign.apply(this, arguments);
32
40
  };
33
41
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
43
  return new (P || (P = Promise))(function (resolve, reject) {
35
44
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
45
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
46
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
47
  step((generator = generator.apply(thisArg, _arguments || [])).next());
39
48
  });
40
49
  };
41
50
  var __generator = (this && this.__generator) || function (thisArg, body) {
42
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
43
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
52
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
44
53
  function verb(n) { return function (v) { return step([n, v]); }; }
45
54
  function step(op) {
46
55
  if (f) throw new TypeError("Generator is already executing.");
47
- while (_) try {
56
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
48
57
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49
58
  if (y = 0, t) op = [op[0] & 2, t.value];
50
59
  switch (op[0]) {
@@ -66,68 +75,207 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
66
75
  }
67
76
  };
68
77
  Object.defineProperty(exports, "__esModule", { value: true });
78
+ exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
79
+ exports.querystring = querystring;
80
+ exports.exists = exists;
81
+ exports.mapValues = mapValues;
82
+ exports.canConsumeForm = canConsumeForm;
69
83
  exports.BASE_PATH = "http://localhost:8080".replace(/\/+$/, "");
70
- var isBlob = function (value) { return typeof Blob !== 'undefined' && value instanceof Blob; };
84
+ var Configuration = /** @class */ (function () {
85
+ function Configuration(configuration) {
86
+ if (configuration === void 0) { configuration = {}; }
87
+ this.configuration = configuration;
88
+ }
89
+ Object.defineProperty(Configuration.prototype, "config", {
90
+ set: function (configuration) {
91
+ this.configuration = configuration;
92
+ },
93
+ enumerable: false,
94
+ configurable: true
95
+ });
96
+ Object.defineProperty(Configuration.prototype, "basePath", {
97
+ get: function () {
98
+ return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
99
+ },
100
+ enumerable: false,
101
+ configurable: true
102
+ });
103
+ Object.defineProperty(Configuration.prototype, "fetchApi", {
104
+ get: function () {
105
+ return this.configuration.fetchApi;
106
+ },
107
+ enumerable: false,
108
+ configurable: true
109
+ });
110
+ Object.defineProperty(Configuration.prototype, "middleware", {
111
+ get: function () {
112
+ return this.configuration.middleware || [];
113
+ },
114
+ enumerable: false,
115
+ configurable: true
116
+ });
117
+ Object.defineProperty(Configuration.prototype, "queryParamsStringify", {
118
+ get: function () {
119
+ return this.configuration.queryParamsStringify || querystring;
120
+ },
121
+ enumerable: false,
122
+ configurable: true
123
+ });
124
+ Object.defineProperty(Configuration.prototype, "username", {
125
+ get: function () {
126
+ return this.configuration.username;
127
+ },
128
+ enumerable: false,
129
+ configurable: true
130
+ });
131
+ Object.defineProperty(Configuration.prototype, "password", {
132
+ get: function () {
133
+ return this.configuration.password;
134
+ },
135
+ enumerable: false,
136
+ configurable: true
137
+ });
138
+ Object.defineProperty(Configuration.prototype, "apiKey", {
139
+ get: function () {
140
+ var apiKey = this.configuration.apiKey;
141
+ if (apiKey) {
142
+ return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
143
+ }
144
+ return undefined;
145
+ },
146
+ enumerable: false,
147
+ configurable: true
148
+ });
149
+ Object.defineProperty(Configuration.prototype, "accessToken", {
150
+ get: function () {
151
+ var _this = this;
152
+ var accessToken = this.configuration.accessToken;
153
+ if (accessToken) {
154
+ return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
155
+ return [2 /*return*/, accessToken];
156
+ }); }); };
157
+ }
158
+ return undefined;
159
+ },
160
+ enumerable: false,
161
+ configurable: true
162
+ });
163
+ Object.defineProperty(Configuration.prototype, "headers", {
164
+ get: function () {
165
+ return this.configuration.headers;
166
+ },
167
+ enumerable: false,
168
+ configurable: true
169
+ });
170
+ Object.defineProperty(Configuration.prototype, "credentials", {
171
+ get: function () {
172
+ return this.configuration.credentials;
173
+ },
174
+ enumerable: false,
175
+ configurable: true
176
+ });
177
+ return Configuration;
178
+ }());
179
+ exports.Configuration = Configuration;
180
+ exports.DefaultConfig = new Configuration();
71
181
  /**
72
182
  * This is the base class for all generated API classes.
73
183
  */
74
184
  var BaseAPI = /** @class */ (function () {
75
185
  function BaseAPI(configuration) {
76
- if (configuration === void 0) { configuration = new Configuration(); }
186
+ if (configuration === void 0) { configuration = exports.DefaultConfig; }
77
187
  var _this = this;
78
188
  this.configuration = configuration;
79
189
  this.fetchApi = function (url, init) { return __awaiter(_this, void 0, void 0, function () {
80
- var fetchParams, _i, _a, middleware, response, _b, _c, middleware;
81
- return __generator(this, function (_d) {
82
- switch (_d.label) {
190
+ var fetchParams, _i, _a, middleware, response, e_1, _b, _c, middleware, _d, _e, middleware;
191
+ return __generator(this, function (_f) {
192
+ switch (_f.label) {
83
193
  case 0:
84
194
  fetchParams = { url: url, init: init };
85
195
  _i = 0, _a = this.middleware;
86
- _d.label = 1;
196
+ _f.label = 1;
87
197
  case 1:
88
198
  if (!(_i < _a.length)) return [3 /*break*/, 4];
89
199
  middleware = _a[_i];
90
200
  if (!middleware.pre) return [3 /*break*/, 3];
91
201
  return [4 /*yield*/, middleware.pre(__assign({ fetch: this.fetchApi }, fetchParams))];
92
202
  case 2:
93
- fetchParams = (_d.sent()) || fetchParams;
94
- _d.label = 3;
203
+ fetchParams = (_f.sent()) || fetchParams;
204
+ _f.label = 3;
95
205
  case 3:
96
206
  _i++;
97
207
  return [3 /*break*/, 1];
98
- case 4: return [4 /*yield*/, (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init)];
208
+ case 4:
209
+ response = undefined;
210
+ _f.label = 5;
99
211
  case 5:
100
- response = _d.sent();
101
- _b = 0, _c = this.middleware;
102
- _d.label = 6;
212
+ _f.trys.push([5, 7, , 12]);
213
+ return [4 /*yield*/, (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init)];
103
214
  case 6:
104
- if (!(_b < _c.length)) return [3 /*break*/, 9];
215
+ response = _f.sent();
216
+ return [3 /*break*/, 12];
217
+ case 7:
218
+ e_1 = _f.sent();
219
+ _b = 0, _c = this.middleware;
220
+ _f.label = 8;
221
+ case 8:
222
+ if (!(_b < _c.length)) return [3 /*break*/, 11];
105
223
  middleware = _c[_b];
106
- if (!middleware.post) return [3 /*break*/, 8];
224
+ if (!middleware.onError) return [3 /*break*/, 10];
225
+ return [4 /*yield*/, middleware.onError({
226
+ fetch: this.fetchApi,
227
+ url: fetchParams.url,
228
+ init: fetchParams.init,
229
+ error: e_1,
230
+ response: response ? response.clone() : undefined,
231
+ })];
232
+ case 9:
233
+ response = (_f.sent()) || response;
234
+ _f.label = 10;
235
+ case 10:
236
+ _b++;
237
+ return [3 /*break*/, 8];
238
+ case 11:
239
+ if (response === undefined) {
240
+ if (e_1 instanceof Error) {
241
+ throw new FetchError(e_1, 'The request failed and the interceptors did not return an alternative response');
242
+ }
243
+ else {
244
+ throw e_1;
245
+ }
246
+ }
247
+ return [3 /*break*/, 12];
248
+ case 12:
249
+ _d = 0, _e = this.middleware;
250
+ _f.label = 13;
251
+ case 13:
252
+ if (!(_d < _e.length)) return [3 /*break*/, 16];
253
+ middleware = _e[_d];
254
+ if (!middleware.post) return [3 /*break*/, 15];
107
255
  return [4 /*yield*/, middleware.post({
108
256
  fetch: this.fetchApi,
109
257
  url: fetchParams.url,
110
258
  init: fetchParams.init,
111
259
  response: response.clone(),
112
260
  })];
113
- case 7:
114
- response = (_d.sent()) || response;
115
- _d.label = 8;
116
- case 8:
117
- _b++;
118
- return [3 /*break*/, 6];
119
- case 9: return [2 /*return*/, response];
261
+ case 14:
262
+ response = (_f.sent()) || response;
263
+ _f.label = 15;
264
+ case 15:
265
+ _d++;
266
+ return [3 /*break*/, 13];
267
+ case 16: return [2 /*return*/, response];
120
268
  }
121
269
  });
122
270
  }); };
123
271
  this.middleware = configuration.middleware;
124
272
  }
125
273
  BaseAPI.prototype.withMiddleware = function () {
274
+ var _a;
126
275
  var middlewares = [];
127
276
  for (var _i = 0; _i < arguments.length; _i++) {
128
277
  middlewares[_i] = arguments[_i];
129
278
  }
130
- var _a;
131
279
  var next = this.clone();
132
280
  next.middleware = (_a = next.middleware).concat.apply(_a, middlewares);
133
281
  return next;
@@ -148,38 +296,91 @@ var BaseAPI = /** @class */ (function () {
148
296
  var middlewares = postMiddlewares.map(function (post) { return ({ post: post }); });
149
297
  return this.withMiddleware.apply(this, middlewares);
150
298
  };
299
+ /**
300
+ * Check if the given MIME is a JSON MIME.
301
+ * JSON MIME examples:
302
+ * application/json
303
+ * application/json; charset=UTF8
304
+ * APPLICATION/JSON
305
+ * application/vnd.company+json
306
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
307
+ * @return True if the given MIME is JSON, false otherwise.
308
+ */
309
+ BaseAPI.prototype.isJsonMime = function (mime) {
310
+ if (!mime) {
311
+ return false;
312
+ }
313
+ return BaseAPI.jsonRegex.test(mime);
314
+ };
151
315
  BaseAPI.prototype.request = function (context, initOverrides) {
152
316
  return __awaiter(this, void 0, void 0, function () {
153
317
  var _a, url, init, response;
154
318
  return __generator(this, function (_b) {
155
319
  switch (_b.label) {
156
- case 0:
157
- _a = this.createFetchParams(context, initOverrides), url = _a.url, init = _a.init;
158
- return [4 /*yield*/, this.fetchApi(url, init)];
320
+ case 0: return [4 /*yield*/, this.createFetchParams(context, initOverrides)];
159
321
  case 1:
322
+ _a = _b.sent(), url = _a.url, init = _a.init;
323
+ return [4 /*yield*/, this.fetchApi(url, init)];
324
+ case 2:
160
325
  response = _b.sent();
161
- if (response.status >= 200 && response.status < 300) {
326
+ if (response && (response.status >= 200 && response.status < 300)) {
162
327
  return [2 /*return*/, response];
163
328
  }
164
- throw response;
329
+ throw new ResponseError(response, 'Response returned an error code');
165
330
  }
166
331
  });
167
332
  });
168
333
  };
169
334
  BaseAPI.prototype.createFetchParams = function (context, initOverrides) {
170
- var url = this.configuration.basePath + context.path;
171
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
172
- // only add the querystring to the URL if there are query parameters.
173
- // this is done to avoid urls ending with a "?" character which buggy webservers
174
- // do not handle correctly sometimes.
175
- url += '?' + this.configuration.queryParamsStringify(context.query);
176
- }
177
- var body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body))
178
- ? context.body
179
- : JSON.stringify(context.body);
180
- var headers = Object.assign({}, this.configuration.headers, context.headers);
181
- var init = __assign({ method: context.method, headers: headers, body: body, credentials: this.configuration.credentials }, initOverrides);
182
- return { url: url, init: init };
335
+ return __awaiter(this, void 0, void 0, function () {
336
+ var url, headers, initOverrideFn, initParams, overriddenInit, _a, body, init;
337
+ var _this = this;
338
+ return __generator(this, function (_b) {
339
+ switch (_b.label) {
340
+ case 0:
341
+ url = this.configuration.basePath + context.path;
342
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
343
+ // only add the querystring to the URL if there are query parameters.
344
+ // this is done to avoid urls ending with a "?" character which buggy webservers
345
+ // do not handle correctly sometimes.
346
+ url += '?' + this.configuration.queryParamsStringify(context.query);
347
+ }
348
+ headers = Object.assign({}, this.configuration.headers, context.headers);
349
+ Object.keys(headers).forEach(function (key) { return headers[key] === undefined ? delete headers[key] : {}; });
350
+ initOverrideFn = typeof initOverrides === "function"
351
+ ? initOverrides
352
+ : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
353
+ return [2 /*return*/, initOverrides];
354
+ }); }); };
355
+ initParams = {
356
+ method: context.method,
357
+ headers: headers,
358
+ body: context.body,
359
+ credentials: this.configuration.credentials,
360
+ };
361
+ _a = [__assign({}, initParams)];
362
+ return [4 /*yield*/, initOverrideFn({
363
+ init: initParams,
364
+ context: context,
365
+ })];
366
+ case 1:
367
+ overriddenInit = __assign.apply(void 0, _a.concat([(_b.sent())]));
368
+ if (isFormData(overriddenInit.body)
369
+ || (overriddenInit.body instanceof URLSearchParams)
370
+ || isBlob(overriddenInit.body)) {
371
+ body = overriddenInit.body;
372
+ }
373
+ else if (this.isJsonMime(headers['Content-Type'])) {
374
+ body = JSON.stringify(overriddenInit.body);
375
+ }
376
+ else {
377
+ body = overriddenInit.body;
378
+ }
379
+ init = __assign(__assign({}, overriddenInit), { body: body });
380
+ return [2 /*return*/, { url: url, init: init }];
381
+ }
382
+ });
383
+ });
183
384
  };
184
385
  /**
185
386
  * Create a shallow clone of `this` by constructing a new instance
@@ -191,10 +392,39 @@ var BaseAPI = /** @class */ (function () {
191
392
  next.middleware = this.middleware.slice();
192
393
  return next;
193
394
  };
395
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
194
396
  return BaseAPI;
195
397
  }());
196
398
  exports.BaseAPI = BaseAPI;
197
399
  ;
400
+ function isBlob(value) {
401
+ return typeof Blob !== 'undefined' && value instanceof Blob;
402
+ }
403
+ function isFormData(value) {
404
+ return typeof FormData !== "undefined" && value instanceof FormData;
405
+ }
406
+ var ResponseError = /** @class */ (function (_super) {
407
+ __extends(ResponseError, _super);
408
+ function ResponseError(response, msg) {
409
+ var _this = _super.call(this, msg) || this;
410
+ _this.response = response;
411
+ _this.name = "ResponseError";
412
+ return _this;
413
+ }
414
+ return ResponseError;
415
+ }(Error));
416
+ exports.ResponseError = ResponseError;
417
+ var FetchError = /** @class */ (function (_super) {
418
+ __extends(FetchError, _super);
419
+ function FetchError(cause, msg) {
420
+ var _this = _super.call(this, msg) || this;
421
+ _this.cause = cause;
422
+ _this.name = "FetchError";
423
+ return _this;
424
+ }
425
+ return FetchError;
426
+ }(Error));
427
+ exports.FetchError = FetchError;
198
428
  var RequiredError = /** @class */ (function (_super) {
199
429
  __extends(RequiredError, _super);
200
430
  function RequiredError(field, msg) {
@@ -212,130 +442,43 @@ exports.COLLECTION_FORMATS = {
212
442
  tsv: "\t",
213
443
  pipes: "|",
214
444
  };
215
- var Configuration = /** @class */ (function () {
216
- function Configuration(configuration) {
217
- if (configuration === void 0) { configuration = {}; }
218
- this.configuration = configuration;
219
- }
220
- Object.defineProperty(Configuration.prototype, "basePath", {
221
- get: function () {
222
- return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
223
- },
224
- enumerable: true,
225
- configurable: true
226
- });
227
- Object.defineProperty(Configuration.prototype, "fetchApi", {
228
- get: function () {
229
- return this.configuration.fetchApi;
230
- },
231
- enumerable: true,
232
- configurable: true
233
- });
234
- Object.defineProperty(Configuration.prototype, "middleware", {
235
- get: function () {
236
- return this.configuration.middleware || [];
237
- },
238
- enumerable: true,
239
- configurable: true
240
- });
241
- Object.defineProperty(Configuration.prototype, "queryParamsStringify", {
242
- get: function () {
243
- return this.configuration.queryParamsStringify || querystring;
244
- },
245
- enumerable: true,
246
- configurable: true
247
- });
248
- Object.defineProperty(Configuration.prototype, "username", {
249
- get: function () {
250
- return this.configuration.username;
251
- },
252
- enumerable: true,
253
- configurable: true
254
- });
255
- Object.defineProperty(Configuration.prototype, "password", {
256
- get: function () {
257
- return this.configuration.password;
258
- },
259
- enumerable: true,
260
- configurable: true
261
- });
262
- Object.defineProperty(Configuration.prototype, "apiKey", {
263
- get: function () {
264
- var apiKey = this.configuration.apiKey;
265
- if (apiKey) {
266
- return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
267
- }
268
- return undefined;
269
- },
270
- enumerable: true,
271
- configurable: true
272
- });
273
- Object.defineProperty(Configuration.prototype, "accessToken", {
274
- get: function () {
275
- var _this = this;
276
- var accessToken = this.configuration.accessToken;
277
- if (accessToken) {
278
- return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
279
- return [2 /*return*/, accessToken];
280
- }); }); };
281
- }
282
- return undefined;
283
- },
284
- enumerable: true,
285
- configurable: true
286
- });
287
- Object.defineProperty(Configuration.prototype, "headers", {
288
- get: function () {
289
- return this.configuration.headers;
290
- },
291
- enumerable: true,
292
- configurable: true
293
- });
294
- Object.defineProperty(Configuration.prototype, "credentials", {
295
- get: function () {
296
- return this.configuration.credentials;
297
- },
298
- enumerable: true,
299
- configurable: true
300
- });
301
- return Configuration;
302
- }());
303
- exports.Configuration = Configuration;
304
- function exists(json, key) {
305
- var value = json[key];
306
- return value !== null && value !== undefined;
307
- }
308
- exports.exists = exists;
309
445
  function querystring(params, prefix) {
310
446
  if (prefix === void 0) { prefix = ''; }
311
447
  return Object.keys(params)
312
- .map(function (key) {
313
- var fullKey = prefix + (prefix.length ? "[" + key + "]" : key);
314
- var value = params[key];
315
- if (value instanceof Array) {
316
- var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
317
- .join("&" + encodeURIComponent(fullKey) + "=");
318
- return encodeURIComponent(fullKey) + "=" + multiValue;
319
- }
320
- if (value instanceof Date) {
321
- return encodeURIComponent(fullKey) + "=" + encodeURIComponent(value.toISOString());
322
- }
323
- if (value instanceof Object) {
324
- return querystring(value, fullKey);
325
- }
326
- return encodeURIComponent(fullKey) + "=" + encodeURIComponent(String(value));
327
- })
448
+ .map(function (key) { return querystringSingleKey(key, params[key], prefix); })
328
449
  .filter(function (part) { return part.length > 0; })
329
450
  .join('&');
330
451
  }
331
- exports.querystring = querystring;
452
+ function querystringSingleKey(key, value, keyPrefix) {
453
+ if (keyPrefix === void 0) { keyPrefix = ''; }
454
+ var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
455
+ if (value instanceof Array) {
456
+ var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
457
+ .join("&".concat(encodeURIComponent(fullKey), "="));
458
+ return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
459
+ }
460
+ if (value instanceof Set) {
461
+ var valueAsArray = Array.from(value);
462
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
463
+ }
464
+ if (value instanceof Date) {
465
+ return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
466
+ }
467
+ if (value instanceof Object) {
468
+ return querystring(value, fullKey);
469
+ }
470
+ return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
471
+ }
472
+ function exists(json, key) {
473
+ var value = json[key];
474
+ return value !== null && value !== undefined;
475
+ }
332
476
  function mapValues(data, fn) {
333
477
  return Object.keys(data).reduce(function (acc, key) {
334
478
  var _a;
335
- return (__assign({}, acc, (_a = {}, _a[key] = fn(data[key]), _a)));
479
+ return (__assign(__assign({}, acc), (_a = {}, _a[key] = fn(data[key]), _a)));
336
480
  }, {});
337
481
  }
338
- exports.mapValues = mapValues;
339
482
  function canConsumeForm(consumes) {
340
483
  for (var _i = 0, consumes_1 = consumes; _i < consumes_1.length; _i++) {
341
484
  var consume = consumes_1[_i];
@@ -345,7 +488,6 @@ function canConsumeForm(consumes) {
345
488
  }
346
489
  return false;
347
490
  }
348
- exports.canConsumeForm = canConsumeForm;
349
491
  var JSONApiResponse = /** @class */ (function () {
350
492
  function JSONApiResponse(raw, transformer) {
351
493
  if (transformer === void 0) { transformer = function (jsonValue) { return jsonValue; }; }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@tapis/tapis-typescript-systems",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "OpenAPI client for @tapis/tapis-typescript-systems",
5
5
  "author": "OpenAPI-Generator",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
9
+ },
6
10
  "main": "./dist/index.js",
7
11
  "typings": "./dist/index.d.ts",
8
12
  "scripts": {
@@ -10,6 +14,6 @@
10
14
  "prepare": "npm run build"
11
15
  },
12
16
  "devDependencies": {
13
- "typescript": "^2.4"
17
+ "typescript": "^4.0 || ^5.0"
14
18
  }
15
19
  }