@uipath/aops-policy-sdk 1.203.0-preview.203

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 (109) hide show
  1. package/LICENSE.txt +3 -0
  2. package/README.md +60 -0
  3. package/dist/generated/src/apis/ApplicationSettingApi.d.ts +37 -0
  4. package/dist/generated/src/apis/ContentApi.d.ts +198 -0
  5. package/dist/generated/src/apis/DeploymentTypeApi.d.ts +26 -0
  6. package/dist/generated/src/apis/GroupApi.d.ts +74 -0
  7. package/dist/generated/src/apis/GwsPartitionMoveApi.d.ts +196 -0
  8. package/dist/generated/src/apis/HomeApi.d.ts +27 -0
  9. package/dist/generated/src/apis/InternalContentApi.d.ts +45 -0
  10. package/dist/generated/src/apis/LicenseTypeApi.d.ts +93 -0
  11. package/dist/generated/src/apis/MaintenanceApi.d.ts +26 -0
  12. package/dist/generated/src/apis/MessageBusApi.d.ts +40 -0
  13. package/dist/generated/src/apis/MigrationApi.d.ts +25 -0
  14. package/dist/generated/src/apis/ModuleFederationApi.d.ts +28 -0
  15. package/dist/generated/src/apis/NotificationApi.d.ts +37 -0
  16. package/dist/generated/src/apis/OrganizationApi.d.ts +55 -0
  17. package/dist/generated/src/apis/PolicyApi.d.ts +379 -0
  18. package/dist/generated/src/apis/ProductApi.d.ts +125 -0
  19. package/dist/generated/src/apis/RuleApi.d.ts +29 -0
  20. package/dist/generated/src/apis/RulesContractsApi.d.ts +29 -0
  21. package/dist/generated/src/apis/S2SContentApi.d.ts +114 -0
  22. package/dist/generated/src/apis/TenantApi.d.ts +69 -0
  23. package/dist/generated/src/apis/TranslationApi.d.ts +28 -0
  24. package/dist/generated/src/apis/UserApi.d.ts +74 -0
  25. package/dist/generated/src/apis/UserEntitlementsApi.d.ts +31 -0
  26. package/dist/generated/src/apis/UserPoliciesApi.d.ts +40 -0
  27. package/dist/generated/src/apis/index.d.ts +24 -0
  28. package/dist/generated/src/index.d.ts +3 -0
  29. package/dist/generated/src/models/AccountState.d.ts +28 -0
  30. package/dist/generated/src/models/AccountStateDto.d.ts +33 -0
  31. package/dist/generated/src/models/AddLicenseTypeRequest.d.ts +38 -0
  32. package/dist/generated/src/models/CloudEvent.d.ts +82 -0
  33. package/dist/generated/src/models/CompatibilityReportRequest.d.ts +44 -0
  34. package/dist/generated/src/models/CompatibilityReportResponse.d.ts +50 -0
  35. package/dist/generated/src/models/CreateGlobalPolicyWithFormDataRequest.d.ts +33 -0
  36. package/dist/generated/src/models/CreatePolicyRequest.d.ts +62 -0
  37. package/dist/generated/src/models/CreatePolicyWithFormDataRequest.d.ts +40 -0
  38. package/dist/generated/src/models/DataCollectionOptions.d.ts +40 -0
  39. package/dist/generated/src/models/DataMoveRequest.d.ts +64 -0
  40. package/dist/generated/src/models/DataMoveResponse.d.ts +50 -0
  41. package/dist/generated/src/models/DeletePartitionRequestDto.d.ts +50 -0
  42. package/dist/generated/src/models/DeletePartitionResponseDto.d.ts +50 -0
  43. package/dist/generated/src/models/DeleteRequest.d.ts +38 -0
  44. package/dist/generated/src/models/DeleteResponse.d.ts +44 -0
  45. package/dist/generated/src/models/DeployedPolicyDto.d.ts +50 -0
  46. package/dist/generated/src/models/DeployedPolicyWithoutUserDto.d.ts +44 -0
  47. package/dist/generated/src/models/DeploymentLevel.d.ts +26 -0
  48. package/dist/generated/src/models/DeploymentTypeOptions.d.ts +32 -0
  49. package/dist/generated/src/models/EvaluateRule.d.ts +45 -0
  50. package/dist/generated/src/models/FederatedPolicyDto.d.ts +84 -0
  51. package/dist/generated/src/models/FederatedPolicyDtoPagedResult.d.ts +39 -0
  52. package/dist/generated/src/models/FinalizeRequest.d.ts +32 -0
  53. package/dist/generated/src/models/FormDataDto.d.ts +38 -0
  54. package/dist/generated/src/models/FormTemplateDto.d.ts +70 -0
  55. package/dist/generated/src/models/GlobalPolicyDto.d.ts +57 -0
  56. package/dist/generated/src/models/GovernanceQueryOptions.d.ts +75 -0
  57. package/dist/generated/src/models/GroupDto.d.ts +63 -0
  58. package/dist/generated/src/models/GroupDtoPagedResult.d.ts +39 -0
  59. package/dist/generated/src/models/GroupPolicyDto.d.ts +50 -0
  60. package/dist/generated/src/models/GroupToAddDto.d.ts +45 -0
  61. package/dist/generated/src/models/ImportPolicyRequest.d.ts +50 -0
  62. package/dist/generated/src/models/InstanceState.d.ts +26 -0
  63. package/dist/generated/src/models/InstanceStateDto.d.ts +33 -0
  64. package/dist/generated/src/models/LicenseTypeDto.d.ts +51 -0
  65. package/dist/generated/src/models/LicenseTypeProductsDto.d.ts +33 -0
  66. package/dist/generated/src/models/MaintenanceModeRequest.d.ts +38 -0
  67. package/dist/generated/src/models/MaintenanceModeResponse.d.ts +44 -0
  68. package/dist/generated/src/models/NotificationDto.d.ts +40 -0
  69. package/dist/generated/src/models/NotificationType.d.ts +25 -0
  70. package/dist/generated/src/models/OrganizationType.d.ts +25 -0
  71. package/dist/generated/src/models/Partition.d.ts +57 -0
  72. package/dist/generated/src/models/PartitionProductDto.d.ts +51 -0
  73. package/dist/generated/src/models/PolicyDto.d.ts +70 -0
  74. package/dist/generated/src/models/PolicyDtoPagedResult.d.ts +39 -0
  75. package/dist/generated/src/models/PolicyExportResponse.d.ts +63 -0
  76. package/dist/generated/src/models/PolicyInfoDto.d.ts +44 -0
  77. package/dist/generated/src/models/PolicyUsageData.d.ts +44 -0
  78. package/dist/generated/src/models/Product.d.ts +45 -0
  79. package/dist/generated/src/models/ProductDto.d.ts +56 -0
  80. package/dist/generated/src/models/PropertiesResponse.d.ts +34 -0
  81. package/dist/generated/src/models/RestorePartitionRequestDto.d.ts +50 -0
  82. package/dist/generated/src/models/RestorePartitionResponseDto.d.ts +44 -0
  83. package/dist/generated/src/models/RollbackRequest.d.ts +38 -0
  84. package/dist/generated/src/models/RollbackResponse.d.ts +44 -0
  85. package/dist/generated/src/models/RulesContractEntity.d.ts +65 -0
  86. package/dist/generated/src/models/RulesContractualOptions.d.ts +33 -0
  87. package/dist/generated/src/models/SeedContentRequest.d.ts +47 -0
  88. package/dist/generated/src/models/SortOrder.d.ts +25 -0
  89. package/dist/generated/src/models/TenantDto.d.ts +57 -0
  90. package/dist/generated/src/models/TenantDtoPagedResult.d.ts +39 -0
  91. package/dist/generated/src/models/TenantPolicyDto.d.ts +56 -0
  92. package/dist/generated/src/models/UpdateFormTemplateRequest.d.ts +51 -0
  93. package/dist/generated/src/models/UpdateLicenseTypeRequest.d.ts +38 -0
  94. package/dist/generated/src/models/UpdatePolicyRequest.d.ts +68 -0
  95. package/dist/generated/src/models/UserDto.d.ts +69 -0
  96. package/dist/generated/src/models/UserDtoPagedResult.d.ts +39 -0
  97. package/dist/generated/src/models/UserPolicyDto.d.ts +50 -0
  98. package/dist/generated/src/models/UserToAddDto.d.ts +45 -0
  99. package/dist/generated/src/models/Version.d.ts +32 -0
  100. package/dist/generated/src/models/VersionDto.d.ts +44 -0
  101. package/dist/generated/src/models/index.d.ts +72 -0
  102. package/dist/generated/src/runtime.d.ts +184 -0
  103. package/dist/index.js +8516 -0
  104. package/dist/policy-resolver.js +1969 -0
  105. package/dist/src/client-factory.d.ts +7 -0
  106. package/dist/src/index.d.ts +4 -0
  107. package/dist/src/policy-resolver.d.ts +102 -0
  108. package/dist/src/user-agent.d.ts +1 -0
  109. package/package.json +46 -0
@@ -0,0 +1,1969 @@
1
+ // generated/src/runtime.ts
2
+ var BASE_PATH = "http://localhost".replace(/\/+$/, "");
3
+
4
+ class Configuration {
5
+ configuration;
6
+ constructor(configuration = {}) {
7
+ this.configuration = configuration;
8
+ }
9
+ set config(configuration) {
10
+ this.configuration = configuration;
11
+ }
12
+ get basePath() {
13
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
14
+ }
15
+ get fetchApi() {
16
+ return this.configuration.fetchApi;
17
+ }
18
+ get middleware() {
19
+ return this.configuration.middleware || [];
20
+ }
21
+ get queryParamsStringify() {
22
+ return this.configuration.queryParamsStringify || querystring;
23
+ }
24
+ get username() {
25
+ return this.configuration.username;
26
+ }
27
+ get password() {
28
+ return this.configuration.password;
29
+ }
30
+ get apiKey() {
31
+ const apiKey = this.configuration.apiKey;
32
+ if (apiKey) {
33
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
34
+ }
35
+ return;
36
+ }
37
+ get accessToken() {
38
+ const accessToken = this.configuration.accessToken;
39
+ if (accessToken) {
40
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
41
+ }
42
+ return;
43
+ }
44
+ get headers() {
45
+ return this.configuration.headers;
46
+ }
47
+ get credentials() {
48
+ return this.configuration.credentials;
49
+ }
50
+ }
51
+ var DefaultConfig = new Configuration;
52
+
53
+ class BaseAPI {
54
+ configuration;
55
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
56
+ middleware;
57
+ constructor(configuration = DefaultConfig) {
58
+ this.configuration = configuration;
59
+ this.middleware = configuration.middleware;
60
+ }
61
+ withMiddleware(...middlewares) {
62
+ const next = this.clone();
63
+ next.middleware = next.middleware.concat(...middlewares);
64
+ return next;
65
+ }
66
+ withPreMiddleware(...preMiddlewares) {
67
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
68
+ return this.withMiddleware(...middlewares);
69
+ }
70
+ withPostMiddleware(...postMiddlewares) {
71
+ const middlewares = postMiddlewares.map((post) => ({ post }));
72
+ return this.withMiddleware(...middlewares);
73
+ }
74
+ isJsonMime(mime) {
75
+ if (!mime) {
76
+ return false;
77
+ }
78
+ return BaseAPI.jsonRegex.test(mime);
79
+ }
80
+ async request(context, initOverrides) {
81
+ const { url, init } = await this.createFetchParams(context, initOverrides);
82
+ const response = await this.fetchApi(url, init);
83
+ if (response && (response.status >= 200 && response.status < 300)) {
84
+ return response;
85
+ }
86
+ throw new ResponseError(response, "Response returned an error code");
87
+ }
88
+ async createFetchParams(context, initOverrides) {
89
+ let url = this.configuration.basePath + context.path;
90
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
91
+ url += "?" + this.configuration.queryParamsStringify(context.query);
92
+ }
93
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
94
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
95
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
96
+ const initParams = {
97
+ method: context.method,
98
+ headers,
99
+ body: context.body,
100
+ credentials: this.configuration.credentials
101
+ };
102
+ const overriddenInit = {
103
+ ...initParams,
104
+ ...await initOverrideFn({
105
+ init: initParams,
106
+ context
107
+ })
108
+ };
109
+ let body;
110
+ if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
111
+ body = overriddenInit.body;
112
+ } else if (this.isJsonMime(headers["Content-Type"])) {
113
+ body = JSON.stringify(overriddenInit.body);
114
+ } else {
115
+ body = overriddenInit.body;
116
+ }
117
+ const init = {
118
+ ...overriddenInit,
119
+ body
120
+ };
121
+ return { url, init };
122
+ }
123
+ fetchApi = async (url, init) => {
124
+ let fetchParams = { url, init };
125
+ for (const middleware of this.middleware) {
126
+ if (middleware.pre) {
127
+ fetchParams = await middleware.pre({
128
+ fetch: this.fetchApi,
129
+ ...fetchParams
130
+ }) || fetchParams;
131
+ }
132
+ }
133
+ let response = undefined;
134
+ try {
135
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
136
+ } catch (e) {
137
+ for (const middleware of this.middleware) {
138
+ if (middleware.onError) {
139
+ response = await middleware.onError({
140
+ fetch: this.fetchApi,
141
+ url: fetchParams.url,
142
+ init: fetchParams.init,
143
+ error: e,
144
+ response: response ? response.clone() : undefined
145
+ }) || response;
146
+ }
147
+ }
148
+ if (response === undefined) {
149
+ if (e instanceof Error) {
150
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
151
+ } else {
152
+ throw e;
153
+ }
154
+ }
155
+ }
156
+ for (const middleware of this.middleware) {
157
+ if (middleware.post) {
158
+ response = await middleware.post({
159
+ fetch: this.fetchApi,
160
+ url: fetchParams.url,
161
+ init: fetchParams.init,
162
+ response: response.clone()
163
+ }) || response;
164
+ }
165
+ }
166
+ return response;
167
+ };
168
+ clone() {
169
+ const constructor = this.constructor;
170
+ const next = new constructor(this.configuration);
171
+ next.middleware = this.middleware.slice();
172
+ return next;
173
+ }
174
+ }
175
+ function isBlob(value) {
176
+ return typeof Blob !== "undefined" && value instanceof Blob;
177
+ }
178
+ function isFormData(value) {
179
+ return typeof FormData !== "undefined" && value instanceof FormData;
180
+ }
181
+
182
+ class ResponseError extends Error {
183
+ response;
184
+ name = "ResponseError";
185
+ constructor(response, msg) {
186
+ super(msg);
187
+ this.response = response;
188
+ }
189
+ }
190
+
191
+ class FetchError extends Error {
192
+ cause;
193
+ name = "FetchError";
194
+ constructor(cause, msg) {
195
+ super(msg);
196
+ this.cause = cause;
197
+ }
198
+ }
199
+
200
+ class RequiredError extends Error {
201
+ field;
202
+ name = "RequiredError";
203
+ constructor(field, msg) {
204
+ super(msg);
205
+ this.field = field;
206
+ }
207
+ }
208
+ var COLLECTION_FORMATS = {
209
+ csv: ",",
210
+ ssv: " ",
211
+ tsv: "\t",
212
+ pipes: "|"
213
+ };
214
+ function querystring(params, prefix = "") {
215
+ return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
216
+ }
217
+ function querystringSingleKey(key, value, keyPrefix = "") {
218
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
219
+ if (value instanceof Array) {
220
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
221
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
222
+ }
223
+ if (value instanceof Set) {
224
+ const valueAsArray = Array.from(value);
225
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
226
+ }
227
+ if (value instanceof Date) {
228
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
229
+ }
230
+ if (value instanceof Object) {
231
+ return querystring(value, fullKey);
232
+ }
233
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
234
+ }
235
+ function exists(json, key) {
236
+ const value = json[key];
237
+ return value !== null && value !== undefined;
238
+ }
239
+ function mapValues(data, fn) {
240
+ const result = {};
241
+ for (const key of Object.keys(data)) {
242
+ result[key] = fn(data[key]);
243
+ }
244
+ return result;
245
+ }
246
+ function canConsumeForm(consumes) {
247
+ for (const consume of consumes) {
248
+ if (consume.contentType === "multipart/form-data") {
249
+ return true;
250
+ }
251
+ }
252
+ return false;
253
+ }
254
+
255
+ class JSONApiResponse {
256
+ raw;
257
+ transformer;
258
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
259
+ this.raw = raw;
260
+ this.transformer = transformer;
261
+ }
262
+ async value() {
263
+ return this.transformer(await this.raw.json());
264
+ }
265
+ }
266
+
267
+ class VoidApiResponse {
268
+ raw;
269
+ constructor(raw) {
270
+ this.raw = raw;
271
+ }
272
+ async value() {
273
+ return;
274
+ }
275
+ }
276
+
277
+ class BlobApiResponse {
278
+ raw;
279
+ constructor(raw) {
280
+ this.raw = raw;
281
+ }
282
+ async value() {
283
+ return await this.raw.blob();
284
+ }
285
+ }
286
+
287
+ class TextApiResponse {
288
+ raw;
289
+ constructor(raw) {
290
+ this.raw = raw;
291
+ }
292
+ async value() {
293
+ return await this.raw.text();
294
+ }
295
+ }
296
+
297
+ // generated/src/models/ProductDto.ts
298
+ function instanceOfProductDto(value) {
299
+ return true;
300
+ }
301
+ function ProductDtoFromJSON(json) {
302
+ return ProductDtoFromJSONTyped(json, false);
303
+ }
304
+ function ProductDtoFromJSONTyped(json, ignoreDiscriminator) {
305
+ if (json == null) {
306
+ return json;
307
+ }
308
+ return {
309
+ name: json["name"] == null ? undefined : json["name"],
310
+ label: json["label"] == null ? undefined : json["label"],
311
+ isRestricted: json["isRestricted"] == null ? undefined : json["isRestricted"],
312
+ isCloud: json["isCloud"] == null ? undefined : json["isCloud"],
313
+ isRemote: json["isRemote"] == null ? undefined : json["isRemote"]
314
+ };
315
+ }
316
+ function ProductDtoToJSON(json) {
317
+ return ProductDtoToJSONTyped(json, false);
318
+ }
319
+ function ProductDtoToJSONTyped(value, ignoreDiscriminator = false) {
320
+ if (value == null) {
321
+ return value;
322
+ }
323
+ return {
324
+ name: value["name"],
325
+ label: value["label"],
326
+ isRestricted: value["isRestricted"],
327
+ isCloud: value["isCloud"],
328
+ isRemote: value["isRemote"]
329
+ };
330
+ }
331
+
332
+ // generated/src/models/GlobalPolicyDto.ts
333
+ function instanceOfGlobalPolicyDto(value) {
334
+ return true;
335
+ }
336
+ function GlobalPolicyDtoFromJSON(json) {
337
+ return GlobalPolicyDtoFromJSONTyped(json, false);
338
+ }
339
+ function GlobalPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
340
+ if (json == null) {
341
+ return json;
342
+ }
343
+ return {
344
+ licenseType: json["licenseType"] == null ? undefined : json["licenseType"],
345
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
346
+ policyNumber: json["policyNumber"] == null ? undefined : json["policyNumber"],
347
+ product: json["product"] == null ? undefined : ProductDtoFromJSON(json["product"]),
348
+ data: json["data"] == null ? undefined : json["data"]
349
+ };
350
+ }
351
+ function GlobalPolicyDtoToJSON(json) {
352
+ return GlobalPolicyDtoToJSONTyped(json, false);
353
+ }
354
+ function GlobalPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
355
+ if (value == null) {
356
+ return value;
357
+ }
358
+ return {
359
+ licenseType: value["licenseType"],
360
+ identifier: value["identifier"],
361
+ policyNumber: value["policyNumber"],
362
+ product: ProductDtoToJSON(value["product"]),
363
+ data: value["data"]
364
+ };
365
+ }
366
+
367
+ // generated/src/models/CreateGlobalPolicyWithFormDataRequest.ts
368
+ function instanceOfCreateGlobalPolicyWithFormDataRequest(value) {
369
+ return true;
370
+ }
371
+ function CreateGlobalPolicyWithFormDataRequestFromJSON(json) {
372
+ return CreateGlobalPolicyWithFormDataRequestFromJSONTyped(json, false);
373
+ }
374
+ function CreateGlobalPolicyWithFormDataRequestFromJSONTyped(json, ignoreDiscriminator) {
375
+ if (json == null) {
376
+ return json;
377
+ }
378
+ return {
379
+ globalPolicy: json["globalPolicy"] == null ? undefined : GlobalPolicyDtoFromJSON(json["globalPolicy"])
380
+ };
381
+ }
382
+ function CreateGlobalPolicyWithFormDataRequestToJSON(json) {
383
+ return CreateGlobalPolicyWithFormDataRequestToJSONTyped(json, false);
384
+ }
385
+ function CreateGlobalPolicyWithFormDataRequestToJSONTyped(value, ignoreDiscriminator = false) {
386
+ if (value == null) {
387
+ return value;
388
+ }
389
+ return {
390
+ globalPolicy: GlobalPolicyDtoToJSON(value["globalPolicy"])
391
+ };
392
+ }
393
+
394
+ // generated/src/models/CreatePolicyRequest.ts
395
+ function instanceOfCreatePolicyRequest(value) {
396
+ return true;
397
+ }
398
+ function CreatePolicyRequestFromJSON(json) {
399
+ return CreatePolicyRequestFromJSONTyped(json, false);
400
+ }
401
+ function CreatePolicyRequestFromJSONTyped(json, ignoreDiscriminator) {
402
+ if (json == null) {
403
+ return json;
404
+ }
405
+ return {
406
+ name: json["name"] == null ? undefined : json["name"],
407
+ description: json["description"] == null ? undefined : json["description"],
408
+ priority: json["priority"] == null ? undefined : json["priority"],
409
+ availability: json["availability"] == null ? undefined : json["availability"],
410
+ productName: json["productName"] == null ? undefined : json["productName"],
411
+ data: json["data"] == null ? undefined : json["data"]
412
+ };
413
+ }
414
+ function CreatePolicyRequestToJSON(json) {
415
+ return CreatePolicyRequestToJSONTyped(json, false);
416
+ }
417
+ function CreatePolicyRequestToJSONTyped(value, ignoreDiscriminator = false) {
418
+ if (value == null) {
419
+ return value;
420
+ }
421
+ return {
422
+ name: value["name"],
423
+ description: value["description"],
424
+ priority: value["priority"],
425
+ availability: value["availability"],
426
+ productName: value["productName"],
427
+ data: value["data"]
428
+ };
429
+ }
430
+
431
+ // generated/src/models/FormDataDto.ts
432
+ function instanceOfFormDataDto(value) {
433
+ return true;
434
+ }
435
+ function FormDataDtoFromJSON(json) {
436
+ return FormDataDtoFromJSONTyped(json, false);
437
+ }
438
+ function FormDataDtoFromJSONTyped(json, ignoreDiscriminator) {
439
+ if (json == null) {
440
+ return json;
441
+ }
442
+ return {
443
+ policyIdentifier: json["policyIdentifier"] == null ? undefined : json["policyIdentifier"],
444
+ data: json["data"] == null ? undefined : json["data"]
445
+ };
446
+ }
447
+ function FormDataDtoToJSON(json) {
448
+ return FormDataDtoToJSONTyped(json, false);
449
+ }
450
+ function FormDataDtoToJSONTyped(value, ignoreDiscriminator = false) {
451
+ if (value == null) {
452
+ return value;
453
+ }
454
+ return {
455
+ policyIdentifier: value["policyIdentifier"],
456
+ data: value["data"]
457
+ };
458
+ }
459
+
460
+ // generated/src/models/PolicyDto.ts
461
+ function instanceOfPolicyDto(value) {
462
+ return true;
463
+ }
464
+ function PolicyDtoFromJSON(json) {
465
+ return PolicyDtoFromJSONTyped(json, false);
466
+ }
467
+ function PolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
468
+ if (json == null) {
469
+ return json;
470
+ }
471
+ return {
472
+ name: json["name"] == null ? undefined : json["name"],
473
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
474
+ description: json["description"] == null ? undefined : json["description"],
475
+ priority: json["priority"] == null ? undefined : json["priority"],
476
+ availability: json["availability"] == null ? undefined : json["availability"],
477
+ product: json["product"] == null ? undefined : ProductDtoFromJSON(json["product"]),
478
+ data: json["data"] == null ? undefined : FormDataDtoFromJSON(json["data"])
479
+ };
480
+ }
481
+ function PolicyDtoToJSON(json) {
482
+ return PolicyDtoToJSONTyped(json, false);
483
+ }
484
+ function PolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
485
+ if (value == null) {
486
+ return value;
487
+ }
488
+ return {
489
+ name: value["name"],
490
+ identifier: value["identifier"],
491
+ description: value["description"],
492
+ priority: value["priority"],
493
+ availability: value["availability"],
494
+ product: ProductDtoToJSON(value["product"]),
495
+ data: FormDataDtoToJSON(value["data"])
496
+ };
497
+ }
498
+
499
+ // generated/src/models/CreatePolicyWithFormDataRequest.ts
500
+ function instanceOfCreatePolicyWithFormDataRequest(value) {
501
+ return true;
502
+ }
503
+ function CreatePolicyWithFormDataRequestFromJSON(json) {
504
+ return CreatePolicyWithFormDataRequestFromJSONTyped(json, false);
505
+ }
506
+ function CreatePolicyWithFormDataRequestFromJSONTyped(json, ignoreDiscriminator) {
507
+ if (json == null) {
508
+ return json;
509
+ }
510
+ return {
511
+ policy: json["policy"] == null ? undefined : PolicyDtoFromJSON(json["policy"]),
512
+ policyFormData: json["policyFormData"] == null ? undefined : FormDataDtoFromJSON(json["policyFormData"])
513
+ };
514
+ }
515
+ function CreatePolicyWithFormDataRequestToJSON(json) {
516
+ return CreatePolicyWithFormDataRequestToJSONTyped(json, false);
517
+ }
518
+ function CreatePolicyWithFormDataRequestToJSONTyped(value, ignoreDiscriminator = false) {
519
+ if (value == null) {
520
+ return value;
521
+ }
522
+ return {
523
+ policy: PolicyDtoToJSON(value["policy"]),
524
+ policyFormData: FormDataDtoToJSON(value["policyFormData"])
525
+ };
526
+ }
527
+
528
+ // generated/src/models/DeployedPolicyDto.ts
529
+ function instanceOfDeployedPolicyDto(value) {
530
+ if (!("licenseType" in value) || value["licenseType"] === undefined)
531
+ return false;
532
+ if (!("productName" in value) || value["productName"] === undefined)
533
+ return false;
534
+ if (!("tenantIdentifier" in value) || value["tenantIdentifier"] === undefined)
535
+ return false;
536
+ if (!("userIdentifier" in value) || value["userIdentifier"] === undefined)
537
+ return false;
538
+ return true;
539
+ }
540
+ function DeployedPolicyDtoFromJSON(json) {
541
+ return DeployedPolicyDtoFromJSONTyped(json, false);
542
+ }
543
+ function DeployedPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
544
+ if (json == null) {
545
+ return json;
546
+ }
547
+ return {
548
+ licenseType: json["licenseType"],
549
+ productName: json["productName"],
550
+ tenantIdentifier: json["tenantIdentifier"],
551
+ userIdentifier: json["userIdentifier"]
552
+ };
553
+ }
554
+ function DeployedPolicyDtoToJSON(json) {
555
+ return DeployedPolicyDtoToJSONTyped(json, false);
556
+ }
557
+ function DeployedPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
558
+ if (value == null) {
559
+ return value;
560
+ }
561
+ return {
562
+ licenseType: value["licenseType"],
563
+ productName: value["productName"],
564
+ tenantIdentifier: value["tenantIdentifier"],
565
+ userIdentifier: value["userIdentifier"]
566
+ };
567
+ }
568
+
569
+ // generated/src/models/DeployedPolicyWithoutUserDto.ts
570
+ function instanceOfDeployedPolicyWithoutUserDto(value) {
571
+ if (!("licenseType" in value) || value["licenseType"] === undefined)
572
+ return false;
573
+ if (!("productName" in value) || value["productName"] === undefined)
574
+ return false;
575
+ if (!("tenantIdentifier" in value) || value["tenantIdentifier"] === undefined)
576
+ return false;
577
+ return true;
578
+ }
579
+ function DeployedPolicyWithoutUserDtoFromJSON(json) {
580
+ return DeployedPolicyWithoutUserDtoFromJSONTyped(json, false);
581
+ }
582
+ function DeployedPolicyWithoutUserDtoFromJSONTyped(json, ignoreDiscriminator) {
583
+ if (json == null) {
584
+ return json;
585
+ }
586
+ return {
587
+ licenseType: json["licenseType"],
588
+ productName: json["productName"],
589
+ tenantIdentifier: json["tenantIdentifier"]
590
+ };
591
+ }
592
+ function DeployedPolicyWithoutUserDtoToJSON(json) {
593
+ return DeployedPolicyWithoutUserDtoToJSONTyped(json, false);
594
+ }
595
+ function DeployedPolicyWithoutUserDtoToJSONTyped(value, ignoreDiscriminator = false) {
596
+ if (value == null) {
597
+ return value;
598
+ }
599
+ return {
600
+ licenseType: value["licenseType"],
601
+ productName: value["productName"],
602
+ tenantIdentifier: value["tenantIdentifier"]
603
+ };
604
+ }
605
+
606
+ // generated/src/models/DeploymentLevel.ts
607
+ var DeploymentLevel = {
608
+ NUMBER_0: 0,
609
+ NUMBER_1: 1,
610
+ NUMBER_2: 2
611
+ };
612
+ function instanceOfDeploymentLevel(value) {
613
+ for (const key in DeploymentLevel) {
614
+ if (Object.prototype.hasOwnProperty.call(DeploymentLevel, key)) {
615
+ if (DeploymentLevel[key] === value) {
616
+ return true;
617
+ }
618
+ }
619
+ }
620
+ return false;
621
+ }
622
+ function DeploymentLevelFromJSON(json) {
623
+ return DeploymentLevelFromJSONTyped(json, false);
624
+ }
625
+ function DeploymentLevelFromJSONTyped(json, ignoreDiscriminator) {
626
+ return json;
627
+ }
628
+ function DeploymentLevelToJSON(value) {
629
+ return value;
630
+ }
631
+ function DeploymentLevelToJSONTyped(value, ignoreDiscriminator) {
632
+ return value;
633
+ }
634
+
635
+ // generated/src/models/TenantPolicyDto.ts
636
+ function instanceOfTenantPolicyDto(value) {
637
+ return true;
638
+ }
639
+ function TenantPolicyDtoFromJSON(json) {
640
+ return TenantPolicyDtoFromJSONTyped(json, false);
641
+ }
642
+ function TenantPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
643
+ if (json == null) {
644
+ return json;
645
+ }
646
+ return {
647
+ tenantIdentifier: json["tenantIdentifier"] == null ? undefined : json["tenantIdentifier"],
648
+ policyIdentifier: json["policyIdentifier"] == null ? undefined : json["policyIdentifier"],
649
+ productIdentifier: json["productIdentifier"] == null ? undefined : json["productIdentifier"],
650
+ licenseTypeIdentifier: json["licenseTypeIdentifier"] == null ? undefined : json["licenseTypeIdentifier"],
651
+ tenantName: json["tenantName"] == null ? undefined : json["tenantName"]
652
+ };
653
+ }
654
+ function TenantPolicyDtoToJSON(json) {
655
+ return TenantPolicyDtoToJSONTyped(json, false);
656
+ }
657
+ function TenantPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
658
+ if (value == null) {
659
+ return value;
660
+ }
661
+ return {
662
+ tenantIdentifier: value["tenantIdentifier"],
663
+ policyIdentifier: value["policyIdentifier"],
664
+ productIdentifier: value["productIdentifier"],
665
+ licenseTypeIdentifier: value["licenseTypeIdentifier"],
666
+ tenantName: value["tenantName"]
667
+ };
668
+ }
669
+
670
+ // generated/src/models/GroupPolicyDto.ts
671
+ function instanceOfGroupPolicyDto(value) {
672
+ return true;
673
+ }
674
+ function GroupPolicyDtoFromJSON(json) {
675
+ return GroupPolicyDtoFromJSONTyped(json, false);
676
+ }
677
+ function GroupPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
678
+ if (json == null) {
679
+ return json;
680
+ }
681
+ return {
682
+ policyIdentifier: json["policyIdentifier"] == null ? undefined : json["policyIdentifier"],
683
+ productIdentifier: json["productIdentifier"] == null ? undefined : json["productIdentifier"],
684
+ groupId: json["groupId"] == null ? undefined : json["groupId"],
685
+ groupName: json["groupName"] == null ? undefined : json["groupName"]
686
+ };
687
+ }
688
+ function GroupPolicyDtoToJSON(json) {
689
+ return GroupPolicyDtoToJSONTyped(json, false);
690
+ }
691
+ function GroupPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
692
+ if (value == null) {
693
+ return value;
694
+ }
695
+ return {
696
+ policyIdentifier: value["policyIdentifier"],
697
+ productIdentifier: value["productIdentifier"],
698
+ groupId: value["groupId"],
699
+ groupName: value["groupName"]
700
+ };
701
+ }
702
+
703
+ // generated/src/models/UserPolicyDto.ts
704
+ function instanceOfUserPolicyDto(value) {
705
+ return true;
706
+ }
707
+ function UserPolicyDtoFromJSON(json) {
708
+ return UserPolicyDtoFromJSONTyped(json, false);
709
+ }
710
+ function UserPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
711
+ if (json == null) {
712
+ return json;
713
+ }
714
+ return {
715
+ policyIdentifier: json["policyIdentifier"] == null ? undefined : json["policyIdentifier"],
716
+ productIdentifier: json["productIdentifier"] == null ? undefined : json["productIdentifier"],
717
+ userId: json["userId"] == null ? undefined : json["userId"],
718
+ userName: json["userName"] == null ? undefined : json["userName"]
719
+ };
720
+ }
721
+ function UserPolicyDtoToJSON(json) {
722
+ return UserPolicyDtoToJSONTyped(json, false);
723
+ }
724
+ function UserPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
725
+ if (value == null) {
726
+ return value;
727
+ }
728
+ return {
729
+ policyIdentifier: value["policyIdentifier"],
730
+ productIdentifier: value["productIdentifier"],
731
+ userId: value["userId"],
732
+ userName: value["userName"]
733
+ };
734
+ }
735
+
736
+ // generated/src/models/FederatedPolicyDto.ts
737
+ function instanceOfFederatedPolicyDto(value) {
738
+ return true;
739
+ }
740
+ function FederatedPolicyDtoFromJSON(json) {
741
+ return FederatedPolicyDtoFromJSONTyped(json, false);
742
+ }
743
+ function FederatedPolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
744
+ if (json == null) {
745
+ return json;
746
+ }
747
+ return {
748
+ name: json["name"] == null ? undefined : json["name"],
749
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
750
+ product: json["product"] == null ? undefined : ProductDtoFromJSON(json["product"]),
751
+ description: json["description"] == null ? undefined : json["description"],
752
+ priority: json["priority"] == null ? undefined : json["priority"],
753
+ availability: json["availability"] == null ? undefined : json["availability"],
754
+ tenantPolicies: json["tenantPolicies"] == null ? undefined : json["tenantPolicies"].map(TenantPolicyDtoFromJSON),
755
+ userPolicies: json["userPolicies"] == null ? undefined : json["userPolicies"].map(UserPolicyDtoFromJSON),
756
+ groupPolicies: json["groupPolicies"] == null ? undefined : json["groupPolicies"].map(GroupPolicyDtoFromJSON)
757
+ };
758
+ }
759
+ function FederatedPolicyDtoToJSON(json) {
760
+ return FederatedPolicyDtoToJSONTyped(json, false);
761
+ }
762
+ function FederatedPolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
763
+ if (value == null) {
764
+ return value;
765
+ }
766
+ return {
767
+ name: value["name"],
768
+ identifier: value["identifier"],
769
+ product: ProductDtoToJSON(value["product"]),
770
+ description: value["description"],
771
+ priority: value["priority"],
772
+ availability: value["availability"],
773
+ tenantPolicies: value["tenantPolicies"] == null ? undefined : value["tenantPolicies"].map(TenantPolicyDtoToJSON),
774
+ userPolicies: value["userPolicies"] == null ? undefined : value["userPolicies"].map(UserPolicyDtoToJSON),
775
+ groupPolicies: value["groupPolicies"] == null ? undefined : value["groupPolicies"].map(GroupPolicyDtoToJSON)
776
+ };
777
+ }
778
+
779
+ // generated/src/models/FederatedPolicyDtoPagedResult.ts
780
+ function instanceOfFederatedPolicyDtoPagedResult(value) {
781
+ return true;
782
+ }
783
+ function FederatedPolicyDtoPagedResultFromJSON(json) {
784
+ return FederatedPolicyDtoPagedResultFromJSONTyped(json, false);
785
+ }
786
+ function FederatedPolicyDtoPagedResultFromJSONTyped(json, ignoreDiscriminator) {
787
+ if (json == null) {
788
+ return json;
789
+ }
790
+ return {
791
+ totalCount: json["totalCount"] == null ? undefined : json["totalCount"],
792
+ result: json["result"] == null ? undefined : json["result"].map(FederatedPolicyDtoFromJSON)
793
+ };
794
+ }
795
+ function FederatedPolicyDtoPagedResultToJSON(json) {
796
+ return FederatedPolicyDtoPagedResultToJSONTyped(json, false);
797
+ }
798
+ function FederatedPolicyDtoPagedResultToJSONTyped(value, ignoreDiscriminator = false) {
799
+ if (value == null) {
800
+ return value;
801
+ }
802
+ return {
803
+ totalCount: value["totalCount"],
804
+ result: value["result"] == null ? undefined : value["result"].map(FederatedPolicyDtoToJSON)
805
+ };
806
+ }
807
+
808
+ // generated/src/models/ImportPolicyRequest.ts
809
+ function instanceOfImportPolicyRequest(value) {
810
+ return true;
811
+ }
812
+ function ImportPolicyRequestFromJSON(json) {
813
+ return ImportPolicyRequestFromJSONTyped(json, false);
814
+ }
815
+ function ImportPolicyRequestFromJSONTyped(json, ignoreDiscriminator) {
816
+ if (json == null) {
817
+ return json;
818
+ }
819
+ return {
820
+ productName: json["product-name"] == null ? undefined : json["product-name"],
821
+ policyName: json["policy-name"] == null ? undefined : json["policy-name"],
822
+ version: json["version"] == null ? undefined : json["version"],
823
+ data: json["data"] == null ? undefined : json["data"]
824
+ };
825
+ }
826
+ function ImportPolicyRequestToJSON(json) {
827
+ return ImportPolicyRequestToJSONTyped(json, false);
828
+ }
829
+ function ImportPolicyRequestToJSONTyped(value, ignoreDiscriminator = false) {
830
+ if (value == null) {
831
+ return value;
832
+ }
833
+ return {
834
+ "product-name": value["productName"],
835
+ "policy-name": value["policyName"],
836
+ version: value["version"],
837
+ data: value["data"]
838
+ };
839
+ }
840
+
841
+ // generated/src/models/PolicyDtoPagedResult.ts
842
+ function instanceOfPolicyDtoPagedResult(value) {
843
+ return true;
844
+ }
845
+ function PolicyDtoPagedResultFromJSON(json) {
846
+ return PolicyDtoPagedResultFromJSONTyped(json, false);
847
+ }
848
+ function PolicyDtoPagedResultFromJSONTyped(json, ignoreDiscriminator) {
849
+ if (json == null) {
850
+ return json;
851
+ }
852
+ return {
853
+ totalCount: json["totalCount"] == null ? undefined : json["totalCount"],
854
+ result: json["result"] == null ? undefined : json["result"].map(PolicyDtoFromJSON)
855
+ };
856
+ }
857
+ function PolicyDtoPagedResultToJSON(json) {
858
+ return PolicyDtoPagedResultToJSONTyped(json, false);
859
+ }
860
+ function PolicyDtoPagedResultToJSONTyped(value, ignoreDiscriminator = false) {
861
+ if (value == null) {
862
+ return value;
863
+ }
864
+ return {
865
+ totalCount: value["totalCount"],
866
+ result: value["result"] == null ? undefined : value["result"].map(PolicyDtoToJSON)
867
+ };
868
+ }
869
+
870
+ // generated/src/models/PolicyExportResponse.ts
871
+ function instanceOfPolicyExportResponse(value) {
872
+ return true;
873
+ }
874
+ function PolicyExportResponseFromJSON(json) {
875
+ return PolicyExportResponseFromJSONTyped(json, false);
876
+ }
877
+ function PolicyExportResponseFromJSONTyped(json, ignoreDiscriminator) {
878
+ if (json == null) {
879
+ return json;
880
+ }
881
+ return {
882
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
883
+ name: json["name"] == null ? undefined : json["name"],
884
+ availability: json["availability"] == null ? undefined : json["availability"],
885
+ data: json["data"] == null ? undefined : json["data"],
886
+ priority: json["priority"] == null ? undefined : json["priority"],
887
+ deploymentLevel: json["deploymentLevel"] == null ? undefined : DeploymentLevelFromJSON(json["deploymentLevel"])
888
+ };
889
+ }
890
+ function PolicyExportResponseToJSON(json) {
891
+ return PolicyExportResponseToJSONTyped(json, false);
892
+ }
893
+ function PolicyExportResponseToJSONTyped(value, ignoreDiscriminator = false) {
894
+ if (value == null) {
895
+ return value;
896
+ }
897
+ return {
898
+ identifier: value["identifier"],
899
+ name: value["name"],
900
+ availability: value["availability"],
901
+ data: value["data"],
902
+ priority: value["priority"],
903
+ deploymentLevel: DeploymentLevelToJSON(value["deploymentLevel"])
904
+ };
905
+ }
906
+
907
+ // generated/src/models/PolicyInfoDto.ts
908
+ function instanceOfPolicyInfoDto(value) {
909
+ return true;
910
+ }
911
+ function PolicyInfoDtoFromJSON(json) {
912
+ return PolicyInfoDtoFromJSONTyped(json, false);
913
+ }
914
+ function PolicyInfoDtoFromJSONTyped(json, ignoreDiscriminator) {
915
+ if (json == null) {
916
+ return json;
917
+ }
918
+ return {
919
+ name: json["name"] == null ? undefined : json["name"],
920
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
921
+ product: json["product"] == null ? undefined : json["product"]
922
+ };
923
+ }
924
+ function PolicyInfoDtoToJSON(json) {
925
+ return PolicyInfoDtoToJSONTyped(json, false);
926
+ }
927
+ function PolicyInfoDtoToJSONTyped(value, ignoreDiscriminator = false) {
928
+ if (value == null) {
929
+ return value;
930
+ }
931
+ return {
932
+ name: value["name"],
933
+ identifier: value["identifier"],
934
+ product: value["product"]
935
+ };
936
+ }
937
+
938
+ // generated/src/models/PolicyUsageData.ts
939
+ function instanceOfPolicyUsageData(value) {
940
+ return true;
941
+ }
942
+ function PolicyUsageDataFromJSON(json) {
943
+ return PolicyUsageDataFromJSONTyped(json, false);
944
+ }
945
+ function PolicyUsageDataFromJSONTyped(json, ignoreDiscriminator) {
946
+ if (json == null) {
947
+ return json;
948
+ }
949
+ return {
950
+ tenants: json["tenants"] == null ? undefined : json["tenants"],
951
+ users: json["users"] == null ? undefined : json["users"],
952
+ groups: json["groups"] == null ? undefined : json["groups"]
953
+ };
954
+ }
955
+ function PolicyUsageDataToJSON(json) {
956
+ return PolicyUsageDataToJSONTyped(json, false);
957
+ }
958
+ function PolicyUsageDataToJSONTyped(value, ignoreDiscriminator = false) {
959
+ if (value == null) {
960
+ return value;
961
+ }
962
+ return {
963
+ tenants: value["tenants"],
964
+ users: value["users"],
965
+ groups: value["groups"]
966
+ };
967
+ }
968
+
969
+ // generated/src/models/UpdatePolicyRequest.ts
970
+ function instanceOfUpdatePolicyRequest(value) {
971
+ return true;
972
+ }
973
+ function UpdatePolicyRequestFromJSON(json) {
974
+ return UpdatePolicyRequestFromJSONTyped(json, false);
975
+ }
976
+ function UpdatePolicyRequestFromJSONTyped(json, ignoreDiscriminator) {
977
+ if (json == null) {
978
+ return json;
979
+ }
980
+ return {
981
+ name: json["name"] == null ? undefined : json["name"],
982
+ identifier: json["identifier"] == null ? undefined : json["identifier"],
983
+ description: json["description"] == null ? undefined : json["description"],
984
+ priority: json["priority"] == null ? undefined : json["priority"],
985
+ availability: json["availability"] == null ? undefined : json["availability"],
986
+ productName: json["productName"] == null ? undefined : json["productName"],
987
+ data: json["data"] == null ? undefined : json["data"]
988
+ };
989
+ }
990
+ function UpdatePolicyRequestToJSON(json) {
991
+ return UpdatePolicyRequestToJSONTyped(json, false);
992
+ }
993
+ function UpdatePolicyRequestToJSONTyped(value, ignoreDiscriminator = false) {
994
+ if (value == null) {
995
+ return value;
996
+ }
997
+ return {
998
+ name: value["name"],
999
+ identifier: value["identifier"],
1000
+ description: value["description"],
1001
+ priority: value["priority"],
1002
+ availability: value["availability"],
1003
+ productName: value["productName"],
1004
+ data: value["data"]
1005
+ };
1006
+ }
1007
+
1008
+ // generated/src/apis/PolicyApi.ts
1009
+ class PolicyApi extends BaseAPI {
1010
+ async policyCreateDefaultPolicyForAllProductsRaw(initOverrides) {
1011
+ const queryParameters = {};
1012
+ const headerParameters = {};
1013
+ if (this.configuration && this.configuration.apiKey) {
1014
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1015
+ }
1016
+ let urlPath = `/api/Policy/default`;
1017
+ const response = await this.request({
1018
+ path: urlPath,
1019
+ method: "POST",
1020
+ headers: headerParameters,
1021
+ query: queryParameters
1022
+ }, initOverrides);
1023
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1024
+ }
1025
+ async policyCreateDefaultPolicyForAllProducts(initOverrides) {
1026
+ const response = await this.policyCreateDefaultPolicyForAllProductsRaw(initOverrides);
1027
+ return await response.value();
1028
+ }
1029
+ async policyCreateFormDataRaw(requestParameters, initOverrides) {
1030
+ if (requestParameters["policyIdentifier"] == null) {
1031
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyCreateFormData().');
1032
+ }
1033
+ const queryParameters = {};
1034
+ const headerParameters = {};
1035
+ headerParameters["Content-Type"] = "application/json";
1036
+ if (this.configuration && this.configuration.apiKey) {
1037
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1038
+ }
1039
+ let urlPath = `/api/Policy/form-data/{policyIdentifier}`;
1040
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1041
+ const response = await this.request({
1042
+ path: urlPath,
1043
+ method: "PUT",
1044
+ headers: headerParameters,
1045
+ query: queryParameters,
1046
+ body: requestParameters["body"]
1047
+ }, initOverrides);
1048
+ if (this.isJsonMime(response.headers.get("content-type"))) {
1049
+ return new JSONApiResponse(response);
1050
+ } else {
1051
+ return new TextApiResponse(response);
1052
+ }
1053
+ }
1054
+ async policyCreateFormData(requestParameters, initOverrides) {
1055
+ const response = await this.policyCreateFormDataRaw(requestParameters, initOverrides);
1056
+ return await response.value();
1057
+ }
1058
+ async policyCreateGlobalPolicyRaw(requestParameters, initOverrides) {
1059
+ const queryParameters = {};
1060
+ const headerParameters = {};
1061
+ headerParameters["Content-Type"] = "application/json";
1062
+ if (this.configuration && this.configuration.apiKey) {
1063
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1064
+ }
1065
+ let urlPath = `/api/Policy/global`;
1066
+ const response = await this.request({
1067
+ path: urlPath,
1068
+ method: "POST",
1069
+ headers: headerParameters,
1070
+ query: queryParameters,
1071
+ body: CreateGlobalPolicyWithFormDataRequestToJSON(requestParameters["createGlobalPolicyWithFormDataRequest"])
1072
+ }, initOverrides);
1073
+ return new JSONApiResponse(response, (jsonValue) => GlobalPolicyDtoFromJSON(jsonValue));
1074
+ }
1075
+ async policyCreateGlobalPolicy(requestParameters = {}, initOverrides) {
1076
+ const response = await this.policyCreateGlobalPolicyRaw(requestParameters, initOverrides);
1077
+ return await response.value();
1078
+ }
1079
+ async policyCreatePolicyRaw(requestParameters, initOverrides) {
1080
+ const queryParameters = {};
1081
+ if (requestParameters["telemetryFlowId"] != null) {
1082
+ queryParameters["telemetryFlowId"] = requestParameters["telemetryFlowId"];
1083
+ }
1084
+ const headerParameters = {};
1085
+ headerParameters["Content-Type"] = "application/json";
1086
+ if (this.configuration && this.configuration.apiKey) {
1087
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1088
+ }
1089
+ let urlPath = `/api/Policy`;
1090
+ const response = await this.request({
1091
+ path: urlPath,
1092
+ method: "POST",
1093
+ headers: headerParameters,
1094
+ query: queryParameters,
1095
+ body: CreatePolicyWithFormDataRequestToJSON(requestParameters["createPolicyWithFormDataRequest"])
1096
+ }, initOverrides);
1097
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1098
+ }
1099
+ async policyCreatePolicy(requestParameters = {}, initOverrides) {
1100
+ const response = await this.policyCreatePolicyRaw(requestParameters, initOverrides);
1101
+ return await response.value();
1102
+ }
1103
+ async policyCreatePolicyV2Raw(requestParameters, initOverrides) {
1104
+ const queryParameters = {};
1105
+ if (requestParameters["telemetryFlowId"] != null) {
1106
+ queryParameters["telemetryFlowId"] = requestParameters["telemetryFlowId"];
1107
+ }
1108
+ const headerParameters = {};
1109
+ headerParameters["Content-Type"] = "application/json";
1110
+ if (this.configuration && this.configuration.apiKey) {
1111
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1112
+ }
1113
+ let urlPath = `/api/Policy/v2/create`;
1114
+ const response = await this.request({
1115
+ path: urlPath,
1116
+ method: "POST",
1117
+ headers: headerParameters,
1118
+ query: queryParameters,
1119
+ body: CreatePolicyRequestToJSON(requestParameters["createPolicyRequest"])
1120
+ }, initOverrides);
1121
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1122
+ }
1123
+ async policyCreatePolicyV2(requestParameters = {}, initOverrides) {
1124
+ const response = await this.policyCreatePolicyV2Raw(requestParameters, initOverrides);
1125
+ return await response.value();
1126
+ }
1127
+ async policyDeletePolicyRaw(requestParameters, initOverrides) {
1128
+ if (requestParameters["policyIdentifier"] == null) {
1129
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyDeletePolicy().');
1130
+ }
1131
+ const queryParameters = {};
1132
+ const headerParameters = {};
1133
+ if (this.configuration && this.configuration.apiKey) {
1134
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1135
+ }
1136
+ let urlPath = `/api/Policy/{policyIdentifier}`;
1137
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1138
+ const response = await this.request({
1139
+ path: urlPath,
1140
+ method: "DELETE",
1141
+ headers: headerParameters,
1142
+ query: queryParameters
1143
+ }, initOverrides);
1144
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1145
+ }
1146
+ async policyDeletePolicy(requestParameters, initOverrides) {
1147
+ const response = await this.policyDeletePolicyRaw(requestParameters, initOverrides);
1148
+ return await response.value();
1149
+ }
1150
+ async policyDeletePolicyByProductNameAndPolicyNameRaw(requestParameters, initOverrides) {
1151
+ if (requestParameters["productName"] == null) {
1152
+ throw new RequiredError("productName", 'Required parameter "productName" was null or undefined when calling policyDeletePolicyByProductNameAndPolicyName().');
1153
+ }
1154
+ if (requestParameters["policyName"] == null) {
1155
+ throw new RequiredError("policyName", 'Required parameter "policyName" was null or undefined when calling policyDeletePolicyByProductNameAndPolicyName().');
1156
+ }
1157
+ const queryParameters = {};
1158
+ const headerParameters = {};
1159
+ if (this.configuration && this.configuration.apiKey) {
1160
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1161
+ }
1162
+ let urlPath = `/api/Policy/product/{productName}/policy/{policyName}`;
1163
+ urlPath = urlPath.replace(`{${"productName"}}`, encodeURIComponent(String(requestParameters["productName"])));
1164
+ urlPath = urlPath.replace(`{${"policyName"}}`, encodeURIComponent(String(requestParameters["policyName"])));
1165
+ const response = await this.request({
1166
+ path: urlPath,
1167
+ method: "DELETE",
1168
+ headers: headerParameters,
1169
+ query: queryParameters
1170
+ }, initOverrides);
1171
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1172
+ }
1173
+ async policyDeletePolicyByProductNameAndPolicyName(requestParameters, initOverrides) {
1174
+ const response = await this.policyDeletePolicyByProductNameAndPolicyNameRaw(requestParameters, initOverrides);
1175
+ return await response.value();
1176
+ }
1177
+ async policyDownloadPolicyByIdentifierRaw(requestParameters, initOverrides) {
1178
+ if (requestParameters["policyIdentifier"] == null) {
1179
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyDownloadPolicyByIdentifier().');
1180
+ }
1181
+ const queryParameters = {};
1182
+ const headerParameters = {};
1183
+ if (this.configuration && this.configuration.apiKey) {
1184
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1185
+ }
1186
+ let urlPath = `/api/Policy/{policyIdentifier}/download`;
1187
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1188
+ const response = await this.request({
1189
+ path: urlPath,
1190
+ method: "GET",
1191
+ headers: headerParameters,
1192
+ query: queryParameters
1193
+ }, initOverrides);
1194
+ return new JSONApiResponse(response, (jsonValue) => PolicyUsageDataFromJSON(jsonValue));
1195
+ }
1196
+ async policyDownloadPolicyByIdentifier(requestParameters, initOverrides) {
1197
+ const response = await this.policyDownloadPolicyByIdentifierRaw(requestParameters, initOverrides);
1198
+ return await response.value();
1199
+ }
1200
+ async policyGetAllPoliciesRaw(initOverrides) {
1201
+ const queryParameters = {};
1202
+ const headerParameters = {};
1203
+ if (this.configuration && this.configuration.apiKey) {
1204
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1205
+ }
1206
+ let urlPath = `/api/Policy`;
1207
+ const response = await this.request({
1208
+ path: urlPath,
1209
+ method: "GET",
1210
+ headers: headerParameters,
1211
+ query: queryParameters
1212
+ }, initOverrides);
1213
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(PolicyDtoFromJSON));
1214
+ }
1215
+ async policyGetAllPolicies(initOverrides) {
1216
+ const response = await this.policyGetAllPoliciesRaw(initOverrides);
1217
+ return await response.value();
1218
+ }
1219
+ async policyGetAllPoliciesByProductIdRaw(requestParameters, initOverrides) {
1220
+ if (requestParameters["productIdentifier"] == null) {
1221
+ throw new RequiredError("productIdentifier", 'Required parameter "productIdentifier" was null or undefined when calling policyGetAllPoliciesByProductId().');
1222
+ }
1223
+ const queryParameters = {};
1224
+ const headerParameters = {};
1225
+ if (this.configuration && this.configuration.apiKey) {
1226
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1227
+ }
1228
+ let urlPath = `/api/Policy/{productIdentifier}`;
1229
+ urlPath = urlPath.replace(`{${"productIdentifier"}}`, encodeURIComponent(String(requestParameters["productIdentifier"])));
1230
+ const response = await this.request({
1231
+ path: urlPath,
1232
+ method: "GET",
1233
+ headers: headerParameters,
1234
+ query: queryParameters
1235
+ }, initOverrides);
1236
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(PolicyDtoFromJSON));
1237
+ }
1238
+ async policyGetAllPoliciesByProductId(requestParameters, initOverrides) {
1239
+ const response = await this.policyGetAllPoliciesByProductIdRaw(requestParameters, initOverrides);
1240
+ return await response.value();
1241
+ }
1242
+ async policyGetAllPoliciesByQueryOptionsRaw(requestParameters, initOverrides) {
1243
+ const queryParameters = {};
1244
+ if (requestParameters["productLabel"] != null) {
1245
+ queryParameters["productLabel"] = requestParameters["productLabel"];
1246
+ }
1247
+ if (requestParameters["productName"] != null) {
1248
+ queryParameters["productName"] = requestParameters["productName"];
1249
+ }
1250
+ if (requestParameters["productNames"] != null) {
1251
+ queryParameters["productNames"] = requestParameters["productNames"];
1252
+ }
1253
+ if (requestParameters["sortBy"] != null) {
1254
+ queryParameters["sortBy"] = requestParameters["sortBy"];
1255
+ }
1256
+ if (requestParameters["sortOrder"] != null) {
1257
+ queryParameters["sortOrder"] = requestParameters["sortOrder"];
1258
+ }
1259
+ if (requestParameters["pageIndex"] != null) {
1260
+ queryParameters["pageIndex"] = requestParameters["pageIndex"];
1261
+ }
1262
+ if (requestParameters["pageSize"] != null) {
1263
+ queryParameters["pageSize"] = requestParameters["pageSize"];
1264
+ }
1265
+ if (requestParameters["searchTerm"] != null) {
1266
+ queryParameters["searchTerm"] = requestParameters["searchTerm"];
1267
+ }
1268
+ const headerParameters = {};
1269
+ if (this.configuration && this.configuration.apiKey) {
1270
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1271
+ }
1272
+ let urlPath = `/api/Policy/paged`;
1273
+ const response = await this.request({
1274
+ path: urlPath,
1275
+ method: "GET",
1276
+ headers: headerParameters,
1277
+ query: queryParameters
1278
+ }, initOverrides);
1279
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoPagedResultFromJSON(jsonValue));
1280
+ }
1281
+ async policyGetAllPoliciesByQueryOptions(requestParameters = {}, initOverrides) {
1282
+ const response = await this.policyGetAllPoliciesByQueryOptionsRaw(requestParameters, initOverrides);
1283
+ return await response.value();
1284
+ }
1285
+ async policyGetAllRulesForProductRaw(requestParameters, initOverrides) {
1286
+ if (requestParameters["licenseType"] == null) {
1287
+ throw new RequiredError("licenseType", 'Required parameter "licenseType" was null or undefined when calling policyGetAllRulesForProduct().');
1288
+ }
1289
+ if (requestParameters["productName"] == null) {
1290
+ throw new RequiredError("productName", 'Required parameter "productName" was null or undefined when calling policyGetAllRulesForProduct().');
1291
+ }
1292
+ if (requestParameters["tenantIdentifier"] == null) {
1293
+ throw new RequiredError("tenantIdentifier", 'Required parameter "tenantIdentifier" was null or undefined when calling policyGetAllRulesForProduct().');
1294
+ }
1295
+ const queryParameters = {};
1296
+ const headerParameters = {};
1297
+ if (this.configuration && this.configuration.apiKey) {
1298
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1299
+ }
1300
+ let urlPath = `/api/Policy/all/license/{licenseType}/product/{productName}/tenant/{tenantIdentifier}`;
1301
+ urlPath = urlPath.replace(`{${"licenseType"}}`, encodeURIComponent(String(requestParameters["licenseType"])));
1302
+ urlPath = urlPath.replace(`{${"productName"}}`, encodeURIComponent(String(requestParameters["productName"])));
1303
+ urlPath = urlPath.replace(`{${"tenantIdentifier"}}`, encodeURIComponent(String(requestParameters["tenantIdentifier"])));
1304
+ const response = await this.request({
1305
+ path: urlPath,
1306
+ method: "GET",
1307
+ headers: headerParameters,
1308
+ query: queryParameters
1309
+ }, initOverrides);
1310
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(PolicyExportResponseFromJSON));
1311
+ }
1312
+ async policyGetAllRulesForProduct(requestParameters, initOverrides) {
1313
+ const response = await this.policyGetAllRulesForProductRaw(requestParameters, initOverrides);
1314
+ return await response.value();
1315
+ }
1316
+ async policyGetDeployedPolicyRaw(requestParameters, initOverrides) {
1317
+ const queryParameters = {};
1318
+ const headerParameters = {};
1319
+ headerParameters["Content-Type"] = "application/json";
1320
+ if (requestParameters["xUiPathClientVersion"] != null) {
1321
+ headerParameters["x-UiPath-ClientVersion"] = String(requestParameters["xUiPathClientVersion"]);
1322
+ }
1323
+ if (this.configuration && this.configuration.apiKey) {
1324
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1325
+ }
1326
+ let urlPath = `/api/Policy/deployed-policy`;
1327
+ const response = await this.request({
1328
+ path: urlPath,
1329
+ method: "POST",
1330
+ headers: headerParameters,
1331
+ query: queryParameters,
1332
+ body: DeployedPolicyDtoToJSON(requestParameters["deployedPolicyDto"])
1333
+ }, initOverrides);
1334
+ return new VoidApiResponse(response);
1335
+ }
1336
+ async policyGetDeployedPolicy(requestParameters = {}, initOverrides) {
1337
+ await this.policyGetDeployedPolicyRaw(requestParameters, initOverrides);
1338
+ }
1339
+ async policyGetDeployedTenantPoliciesRaw(requestParameters, initOverrides) {
1340
+ const queryParameters = {};
1341
+ const headerParameters = {};
1342
+ headerParameters["Content-Type"] = "application/json";
1343
+ if (requestParameters["xUiPathClientVersion"] != null) {
1344
+ headerParameters["x-UiPath-ClientVersion"] = String(requestParameters["xUiPathClientVersion"]);
1345
+ }
1346
+ if (this.configuration && this.configuration.apiKey) {
1347
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1348
+ }
1349
+ let urlPath = `/api/Policy/deployed-policy/tenant`;
1350
+ const response = await this.request({
1351
+ path: urlPath,
1352
+ method: "POST",
1353
+ headers: headerParameters,
1354
+ query: queryParameters,
1355
+ body: DeployedPolicyWithoutUserDtoToJSON(requestParameters["deployedPolicyWithoutUserDto"])
1356
+ }, initOverrides);
1357
+ return new VoidApiResponse(response);
1358
+ }
1359
+ async policyGetDeployedTenantPolicies(requestParameters = {}, initOverrides) {
1360
+ await this.policyGetDeployedTenantPoliciesRaw(requestParameters, initOverrides);
1361
+ }
1362
+ async policyGetFederatedPoliciesByQueryOptionsRaw(requestParameters, initOverrides) {
1363
+ const queryParameters = {};
1364
+ if (requestParameters["productLabel"] != null) {
1365
+ queryParameters["productLabel"] = requestParameters["productLabel"];
1366
+ }
1367
+ if (requestParameters["productName"] != null) {
1368
+ queryParameters["productName"] = requestParameters["productName"];
1369
+ }
1370
+ if (requestParameters["productNames"] != null) {
1371
+ queryParameters["productNames"] = requestParameters["productNames"];
1372
+ }
1373
+ if (requestParameters["sortBy"] != null) {
1374
+ queryParameters["sortBy"] = requestParameters["sortBy"];
1375
+ }
1376
+ if (requestParameters["sortOrder"] != null) {
1377
+ queryParameters["sortOrder"] = requestParameters["sortOrder"];
1378
+ }
1379
+ if (requestParameters["pageIndex"] != null) {
1380
+ queryParameters["pageIndex"] = requestParameters["pageIndex"];
1381
+ }
1382
+ if (requestParameters["pageSize"] != null) {
1383
+ queryParameters["pageSize"] = requestParameters["pageSize"];
1384
+ }
1385
+ if (requestParameters["searchTerm"] != null) {
1386
+ queryParameters["searchTerm"] = requestParameters["searchTerm"];
1387
+ }
1388
+ const headerParameters = {};
1389
+ if (this.configuration && this.configuration.apiKey) {
1390
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1391
+ }
1392
+ let urlPath = `/api/Policy/federated/paged`;
1393
+ const response = await this.request({
1394
+ path: urlPath,
1395
+ method: "GET",
1396
+ headers: headerParameters,
1397
+ query: queryParameters
1398
+ }, initOverrides);
1399
+ return new JSONApiResponse(response, (jsonValue) => FederatedPolicyDtoPagedResultFromJSON(jsonValue));
1400
+ }
1401
+ async policyGetFederatedPoliciesByQueryOptions(requestParameters = {}, initOverrides) {
1402
+ const response = await this.policyGetFederatedPoliciesByQueryOptionsRaw(requestParameters, initOverrides);
1403
+ return await response.value();
1404
+ }
1405
+ async policyGetFormDataByPolicyIdRaw(requestParameters, initOverrides) {
1406
+ if (requestParameters["policyIdentifier"] == null) {
1407
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyGetFormDataByPolicyId().');
1408
+ }
1409
+ const queryParameters = {};
1410
+ const headerParameters = {};
1411
+ if (this.configuration && this.configuration.apiKey) {
1412
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1413
+ }
1414
+ let urlPath = `/api/Policy/form-data/{policyIdentifier}`;
1415
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1416
+ const response = await this.request({
1417
+ path: urlPath,
1418
+ method: "GET",
1419
+ headers: headerParameters,
1420
+ query: queryParameters
1421
+ }, initOverrides);
1422
+ if (this.isJsonMime(response.headers.get("content-type"))) {
1423
+ return new JSONApiResponse(response);
1424
+ } else {
1425
+ return new TextApiResponse(response);
1426
+ }
1427
+ }
1428
+ async policyGetFormDataByPolicyId(requestParameters, initOverrides) {
1429
+ const response = await this.policyGetFormDataByPolicyIdRaw(requestParameters, initOverrides);
1430
+ return await response.value();
1431
+ }
1432
+ async policyGetGlobalPolicyByLicenseTypeAndProductNameRaw(requestParameters, initOverrides) {
1433
+ if (requestParameters["licenseType"] == null) {
1434
+ throw new RequiredError("licenseType", 'Required parameter "licenseType" was null or undefined when calling policyGetGlobalPolicyByLicenseTypeAndProductName().');
1435
+ }
1436
+ if (requestParameters["productIdentifier"] == null) {
1437
+ throw new RequiredError("productIdentifier", 'Required parameter "productIdentifier" was null or undefined when calling policyGetGlobalPolicyByLicenseTypeAndProductName().');
1438
+ }
1439
+ const queryParameters = {};
1440
+ const headerParameters = {};
1441
+ if (this.configuration && this.configuration.apiKey) {
1442
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1443
+ }
1444
+ let urlPath = `/api/Policy/global/license/{licenseType}/product/{productIdentifier}`;
1445
+ urlPath = urlPath.replace(`{${"licenseType"}}`, encodeURIComponent(String(requestParameters["licenseType"])));
1446
+ urlPath = urlPath.replace(`{${"productIdentifier"}}`, encodeURIComponent(String(requestParameters["productIdentifier"])));
1447
+ const response = await this.request({
1448
+ path: urlPath,
1449
+ method: "GET",
1450
+ headers: headerParameters,
1451
+ query: queryParameters
1452
+ }, initOverrides);
1453
+ return new JSONApiResponse(response, (jsonValue) => GlobalPolicyDtoFromJSON(jsonValue));
1454
+ }
1455
+ async policyGetGlobalPolicyByLicenseTypeAndProductName(requestParameters, initOverrides) {
1456
+ const response = await this.policyGetGlobalPolicyByLicenseTypeAndProductNameRaw(requestParameters, initOverrides);
1457
+ return await response.value();
1458
+ }
1459
+ async policyGetGroupPoliciesForAllProductsRaw(requestParameters, initOverrides) {
1460
+ if (requestParameters["identifier"] == null) {
1461
+ throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling policyGetGroupPoliciesForAllProducts().');
1462
+ }
1463
+ const queryParameters = {};
1464
+ const headerParameters = {};
1465
+ if (this.configuration && this.configuration.apiKey) {
1466
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1467
+ }
1468
+ let urlPath = `/api/Policy/group/{identifier}`;
1469
+ urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
1470
+ const response = await this.request({
1471
+ path: urlPath,
1472
+ method: "GET",
1473
+ headers: headerParameters,
1474
+ query: queryParameters
1475
+ }, initOverrides);
1476
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(GroupPolicyDtoFromJSON));
1477
+ }
1478
+ async policyGetGroupPoliciesForAllProducts(requestParameters, initOverrides) {
1479
+ const response = await this.policyGetGroupPoliciesForAllProductsRaw(requestParameters, initOverrides);
1480
+ return await response.value();
1481
+ }
1482
+ async policyGetPoliciesByProductIdentifiersRaw(requestParameters, initOverrides) {
1483
+ const queryParameters = {};
1484
+ if (requestParameters["ids"] != null) {
1485
+ queryParameters["ids"] = requestParameters["ids"];
1486
+ }
1487
+ const headerParameters = {};
1488
+ if (this.configuration && this.configuration.apiKey) {
1489
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1490
+ }
1491
+ let urlPath = `/api/Policy/filter/products`;
1492
+ const response = await this.request({
1493
+ path: urlPath,
1494
+ method: "GET",
1495
+ headers: headerParameters,
1496
+ query: queryParameters
1497
+ }, initOverrides);
1498
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(PolicyInfoDtoFromJSON));
1499
+ }
1500
+ async policyGetPoliciesByProductIdentifiers(requestParameters = {}, initOverrides) {
1501
+ const response = await this.policyGetPoliciesByProductIdentifiersRaw(requestParameters, initOverrides);
1502
+ return await response.value();
1503
+ }
1504
+ async policyGetPolicyByIdRaw(requestParameters, initOverrides) {
1505
+ if (requestParameters["policyIdentifier"] == null) {
1506
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyGetPolicyById().');
1507
+ }
1508
+ const queryParameters = {};
1509
+ const headerParameters = {};
1510
+ if (this.configuration && this.configuration.apiKey) {
1511
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1512
+ }
1513
+ let urlPath = `/api/Policy/id/{policyIdentifier}`;
1514
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1515
+ const response = await this.request({
1516
+ path: urlPath,
1517
+ method: "GET",
1518
+ headers: headerParameters,
1519
+ query: queryParameters
1520
+ }, initOverrides);
1521
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1522
+ }
1523
+ async policyGetPolicyById(requestParameters, initOverrides) {
1524
+ const response = await this.policyGetPolicyByIdRaw(requestParameters, initOverrides);
1525
+ return await response.value();
1526
+ }
1527
+ async policyGetPolicyByNameAndProductIdentifierRaw(requestParameters, initOverrides) {
1528
+ if (requestParameters["policyName"] == null) {
1529
+ throw new RequiredError("policyName", 'Required parameter "policyName" was null or undefined when calling policyGetPolicyByNameAndProductIdentifier().');
1530
+ }
1531
+ if (requestParameters["productIdentifier"] == null) {
1532
+ throw new RequiredError("productIdentifier", 'Required parameter "productIdentifier" was null or undefined when calling policyGetPolicyByNameAndProductIdentifier().');
1533
+ }
1534
+ const queryParameters = {};
1535
+ const headerParameters = {};
1536
+ if (this.configuration && this.configuration.apiKey) {
1537
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1538
+ }
1539
+ let urlPath = `/api/Policy/{policyName}/product/{productIdentifier}`;
1540
+ urlPath = urlPath.replace(`{${"policyName"}}`, encodeURIComponent(String(requestParameters["policyName"])));
1541
+ urlPath = urlPath.replace(`{${"productIdentifier"}}`, encodeURIComponent(String(requestParameters["productIdentifier"])));
1542
+ const response = await this.request({
1543
+ path: urlPath,
1544
+ method: "GET",
1545
+ headers: headerParameters,
1546
+ query: queryParameters
1547
+ }, initOverrides);
1548
+ return new JSONApiResponse(response, (jsonValue) => PolicyUsageDataFromJSON(jsonValue));
1549
+ }
1550
+ async policyGetPolicyByNameAndProductIdentifier(requestParameters, initOverrides) {
1551
+ const response = await this.policyGetPolicyByNameAndProductIdentifierRaw(requestParameters, initOverrides);
1552
+ return await response.value();
1553
+ }
1554
+ async policyGetPolicyDataByIdentifierRaw(requestParameters, initOverrides) {
1555
+ if (requestParameters["policyIdentifier"] == null) {
1556
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyGetPolicyDataByIdentifier().');
1557
+ }
1558
+ const queryParameters = {};
1559
+ const headerParameters = {};
1560
+ if (this.configuration && this.configuration.apiKey) {
1561
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1562
+ }
1563
+ let urlPath = `/api/Policy/data/{policyIdentifier}`;
1564
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1565
+ const response = await this.request({
1566
+ path: urlPath,
1567
+ method: "GET",
1568
+ headers: headerParameters,
1569
+ query: queryParameters
1570
+ }, initOverrides);
1571
+ return new JSONApiResponse(response, (jsonValue) => ImportPolicyRequestFromJSON(jsonValue));
1572
+ }
1573
+ async policyGetPolicyDataByIdentifier(requestParameters, initOverrides) {
1574
+ const response = await this.policyGetPolicyDataByIdentifierRaw(requestParameters, initOverrides);
1575
+ return await response.value();
1576
+ }
1577
+ async policyGetPolicyUsageDataRaw(requestParameters, initOverrides) {
1578
+ if (requestParameters["policyIdentifier"] == null) {
1579
+ throw new RequiredError("policyIdentifier", 'Required parameter "policyIdentifier" was null or undefined when calling policyGetPolicyUsageData().');
1580
+ }
1581
+ const queryParameters = {};
1582
+ const headerParameters = {};
1583
+ if (this.configuration && this.configuration.apiKey) {
1584
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1585
+ }
1586
+ let urlPath = `/api/Policy/usage/{policyIdentifier}`;
1587
+ urlPath = urlPath.replace(`{${"policyIdentifier"}}`, encodeURIComponent(String(requestParameters["policyIdentifier"])));
1588
+ const response = await this.request({
1589
+ path: urlPath,
1590
+ method: "GET",
1591
+ headers: headerParameters,
1592
+ query: queryParameters
1593
+ }, initOverrides);
1594
+ return new JSONApiResponse(response, (jsonValue) => PolicyUsageDataFromJSON(jsonValue));
1595
+ }
1596
+ async policyGetPolicyUsageData(requestParameters, initOverrides) {
1597
+ const response = await this.policyGetPolicyUsageDataRaw(requestParameters, initOverrides);
1598
+ return await response.value();
1599
+ }
1600
+ async policyGetRulesForProductRaw(requestParameters, initOverrides) {
1601
+ if (requestParameters["licenseType"] == null) {
1602
+ throw new RequiredError("licenseType", 'Required parameter "licenseType" was null or undefined when calling policyGetRulesForProduct().');
1603
+ }
1604
+ if (requestParameters["productName"] == null) {
1605
+ throw new RequiredError("productName", 'Required parameter "productName" was null or undefined when calling policyGetRulesForProduct().');
1606
+ }
1607
+ if (requestParameters["tenantIdentifier"] == null) {
1608
+ throw new RequiredError("tenantIdentifier", 'Required parameter "tenantIdentifier" was null or undefined when calling policyGetRulesForProduct().');
1609
+ }
1610
+ const queryParameters = {};
1611
+ const headerParameters = {};
1612
+ if (this.configuration && this.configuration.apiKey) {
1613
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1614
+ }
1615
+ let urlPath = `/api/Policy/license/{licenseType}/product/{productName}/tenant/{tenantIdentifier}`;
1616
+ urlPath = urlPath.replace(`{${"licenseType"}}`, encodeURIComponent(String(requestParameters["licenseType"])));
1617
+ urlPath = urlPath.replace(`{${"productName"}}`, encodeURIComponent(String(requestParameters["productName"])));
1618
+ urlPath = urlPath.replace(`{${"tenantIdentifier"}}`, encodeURIComponent(String(requestParameters["tenantIdentifier"])));
1619
+ const response = await this.request({
1620
+ path: urlPath,
1621
+ method: "GET",
1622
+ headers: headerParameters,
1623
+ query: queryParameters
1624
+ }, initOverrides);
1625
+ return new VoidApiResponse(response);
1626
+ }
1627
+ async policyGetRulesForProduct(requestParameters, initOverrides) {
1628
+ await this.policyGetRulesForProductRaw(requestParameters, initOverrides);
1629
+ }
1630
+ async policyGetUserInheritanceGroupPoliciesForAllProductsRaw(requestParameters, initOverrides) {
1631
+ if (requestParameters["identifier"] == null) {
1632
+ throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling policyGetUserInheritanceGroupPoliciesForAllProducts().');
1633
+ }
1634
+ const queryParameters = {};
1635
+ const headerParameters = {};
1636
+ if (this.configuration && this.configuration.apiKey) {
1637
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1638
+ }
1639
+ let urlPath = `/api/Policy/user/group/{identifier}`;
1640
+ urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
1641
+ const response = await this.request({
1642
+ path: urlPath,
1643
+ method: "GET",
1644
+ headers: headerParameters,
1645
+ query: queryParameters
1646
+ }, initOverrides);
1647
+ return new VoidApiResponse(response);
1648
+ }
1649
+ async policyGetUserInheritanceGroupPoliciesForAllProducts(requestParameters, initOverrides) {
1650
+ await this.policyGetUserInheritanceGroupPoliciesForAllProductsRaw(requestParameters, initOverrides);
1651
+ }
1652
+ async policyGetUserPoliciesForAllProductsRaw(requestParameters, initOverrides) {
1653
+ if (requestParameters["identifier"] == null) {
1654
+ throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling policyGetUserPoliciesForAllProducts().');
1655
+ }
1656
+ const queryParameters = {};
1657
+ const headerParameters = {};
1658
+ if (this.configuration && this.configuration.apiKey) {
1659
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1660
+ }
1661
+ let urlPath = `/api/Policy/user/{identifier}`;
1662
+ urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
1663
+ const response = await this.request({
1664
+ path: urlPath,
1665
+ method: "GET",
1666
+ headers: headerParameters,
1667
+ query: queryParameters
1668
+ }, initOverrides);
1669
+ return new VoidApiResponse(response);
1670
+ }
1671
+ async policyGetUserPoliciesForAllProducts(requestParameters, initOverrides) {
1672
+ await this.policyGetUserPoliciesForAllProductsRaw(requestParameters, initOverrides);
1673
+ }
1674
+ async policyGetUserPoliciesForAllProductsAndAllGroupsRaw(requestParameters, initOverrides) {
1675
+ if (requestParameters["identifier"] == null) {
1676
+ throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling policyGetUserPoliciesForAllProductsAndAllGroups().');
1677
+ }
1678
+ const queryParameters = {};
1679
+ const headerParameters = {};
1680
+ if (this.configuration && this.configuration.apiKey) {
1681
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1682
+ }
1683
+ let urlPath = `/api/Policy/user/{identifier}/all`;
1684
+ urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
1685
+ const response = await this.request({
1686
+ path: urlPath,
1687
+ method: "GET",
1688
+ headers: headerParameters,
1689
+ query: queryParameters
1690
+ }, initOverrides);
1691
+ return new VoidApiResponse(response);
1692
+ }
1693
+ async policyGetUserPoliciesForAllProductsAndAllGroups(requestParameters, initOverrides) {
1694
+ await this.policyGetUserPoliciesForAllProductsAndAllGroupsRaw(requestParameters, initOverrides);
1695
+ }
1696
+ async policyUpdateGlobalPolicyRaw(requestParameters, initOverrides) {
1697
+ const queryParameters = {};
1698
+ const headerParameters = {};
1699
+ headerParameters["Content-Type"] = "application/json";
1700
+ if (this.configuration && this.configuration.apiKey) {
1701
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1702
+ }
1703
+ let urlPath = `/api/Policy/global`;
1704
+ const response = await this.request({
1705
+ path: urlPath,
1706
+ method: "PUT",
1707
+ headers: headerParameters,
1708
+ query: queryParameters,
1709
+ body: CreateGlobalPolicyWithFormDataRequestToJSON(requestParameters["createGlobalPolicyWithFormDataRequest"])
1710
+ }, initOverrides);
1711
+ return new JSONApiResponse(response, (jsonValue) => GlobalPolicyDtoFromJSON(jsonValue));
1712
+ }
1713
+ async policyUpdateGlobalPolicy(requestParameters = {}, initOverrides) {
1714
+ const response = await this.policyUpdateGlobalPolicyRaw(requestParameters, initOverrides);
1715
+ return await response.value();
1716
+ }
1717
+ async policyUpdatePolicyRaw(requestParameters, initOverrides) {
1718
+ const queryParameters = {};
1719
+ const headerParameters = {};
1720
+ headerParameters["Content-Type"] = "application/json";
1721
+ if (this.configuration && this.configuration.apiKey) {
1722
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1723
+ }
1724
+ let urlPath = `/api/Policy`;
1725
+ const response = await this.request({
1726
+ path: urlPath,
1727
+ method: "PUT",
1728
+ headers: headerParameters,
1729
+ query: queryParameters,
1730
+ body: CreatePolicyWithFormDataRequestToJSON(requestParameters["createPolicyWithFormDataRequest"])
1731
+ }, initOverrides);
1732
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1733
+ }
1734
+ async policyUpdatePolicy(requestParameters = {}, initOverrides) {
1735
+ const response = await this.policyUpdatePolicyRaw(requestParameters, initOverrides);
1736
+ return await response.value();
1737
+ }
1738
+ async policyUpdatePolicyV2Raw(requestParameters, initOverrides) {
1739
+ const queryParameters = {};
1740
+ const headerParameters = {};
1741
+ headerParameters["Content-Type"] = "application/json";
1742
+ if (this.configuration && this.configuration.apiKey) {
1743
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1744
+ }
1745
+ let urlPath = `/api/Policy/v2/update`;
1746
+ const response = await this.request({
1747
+ path: urlPath,
1748
+ method: "PUT",
1749
+ headers: headerParameters,
1750
+ query: queryParameters,
1751
+ body: UpdatePolicyRequestToJSON(requestParameters["updatePolicyRequest"])
1752
+ }, initOverrides);
1753
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1754
+ }
1755
+ async policyUpdatePolicyV2(requestParameters = {}, initOverrides) {
1756
+ const response = await this.policyUpdatePolicyV2Raw(requestParameters, initOverrides);
1757
+ return await response.value();
1758
+ }
1759
+ async policyUploadCheckPolicyRaw(requestParameters, initOverrides) {
1760
+ const queryParameters = {};
1761
+ const headerParameters = {};
1762
+ if (this.configuration && this.configuration.apiKey) {
1763
+ headerParameters["Authorization"] = await this.configuration.apiKey("Authorization");
1764
+ }
1765
+ const consumes = [
1766
+ { contentType: "multipart/form-data" }
1767
+ ];
1768
+ const canConsumeForm2 = canConsumeForm(consumes);
1769
+ let formParams;
1770
+ let useForm = false;
1771
+ useForm = canConsumeForm2;
1772
+ if (useForm) {
1773
+ formParams = new FormData;
1774
+ } else {
1775
+ formParams = new URLSearchParams;
1776
+ }
1777
+ if (requestParameters["file"] != null) {
1778
+ formParams.append("file", requestParameters["file"]);
1779
+ }
1780
+ let urlPath = `/api/Policy/upload/check`;
1781
+ const response = await this.request({
1782
+ path: urlPath,
1783
+ method: "POST",
1784
+ headers: headerParameters,
1785
+ query: queryParameters,
1786
+ body: formParams
1787
+ }, initOverrides);
1788
+ return new JSONApiResponse(response, (jsonValue) => PolicyDtoFromJSON(jsonValue));
1789
+ }
1790
+ async policyUploadCheckPolicy(requestParameters = {}, initOverrides) {
1791
+ const response = await this.policyUploadCheckPolicyRaw(requestParameters, initOverrides);
1792
+ return await response.value();
1793
+ }
1794
+ }
1795
+
1796
+ // src/policy-resolver.ts
1797
+ var DEFAULT_TIMEOUT_MS = 1e4;
1798
+ var CLIENT_VERSION_HEADER = "ClientVersion";
1799
+ var JSON_MIME = /^application\/(json|[^;\s]+\+json)\s*(;.*)?$/i;
1800
+ async function resolvePolicyAsync(options) {
1801
+ const subject = options.subject;
1802
+ requireValue("subject", subject);
1803
+ requireText("subject.organizationId", subject.organizationId);
1804
+ requireText("subject.tenantId", subject.tenantId);
1805
+ requireText("subject.product", subject.product);
1806
+ requireText("subject.licenseType", subject.licenseType);
1807
+ requireText("baseUrl", options.baseUrl);
1808
+ requireText("clientVersion", options.clientVersion);
1809
+ const fetchApi = options.fetch ?? globalThis.fetch;
1810
+ if (typeof fetchApi !== "function") {
1811
+ throw new RequiredError("fetch", "No fetch implementation available. Pass options.fetch.");
1812
+ }
1813
+ const now = options.now ?? (() => new Date);
1814
+ const basePath = `${options.baseUrl.replace(/\/+$/, "")}/${encodeURIComponent(subject.organizationId)}/roboticsops_`;
1815
+ let requestUrl = basePath;
1816
+ const api = new PolicyApi(new Configuration({
1817
+ basePath,
1818
+ fetchApi,
1819
+ apiKey: async () => `Bearer ${await readToken(options.accessToken)}`,
1820
+ headers: {
1821
+ AccountId: subject.organizationId,
1822
+ [CLIENT_VERSION_HEADER]: options.clientVersion
1823
+ },
1824
+ middleware: [
1825
+ {
1826
+ pre: async (context) => {
1827
+ requestUrl = context.url;
1828
+ }
1829
+ }
1830
+ ]
1831
+ }));
1832
+ if (options.signal?.aborted) {
1833
+ return unknown(subject, buildAudit(requestUrl, now), "cancelled", "The request was cancelled before it was sent.");
1834
+ }
1835
+ const controller = new AbortController;
1836
+ let timedOut = false;
1837
+ const timer = setTimeout(() => {
1838
+ timedOut = true;
1839
+ controller.abort();
1840
+ }, options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
1841
+ const relayAbort = () => controller.abort();
1842
+ options.signal?.addEventListener("abort", relayAbort, { once: true });
1843
+ let seenResponse;
1844
+ try {
1845
+ const response = await api.policyGetRulesForProductRaw({
1846
+ licenseType: subject.licenseType,
1847
+ productName: subject.product,
1848
+ tenantIdentifier: subject.tenantId
1849
+ }, { signal: controller.signal });
1850
+ seenResponse = response.raw;
1851
+ return await classifySuccess(response.raw, subject, requestUrl, now);
1852
+ } catch (error) {
1853
+ return classifyFailure(error, subject, requestUrl, now, timedOut, options.signal, seenResponse);
1854
+ } finally {
1855
+ clearTimeout(timer);
1856
+ options.signal?.removeEventListener("abort", relayAbort);
1857
+ }
1858
+ }
1859
+ async function classifySuccess(response, subject, url, now) {
1860
+ const audit = buildAudit(url, now, response);
1861
+ if (response.status === 204) {
1862
+ return { outcome: "ungoverned", subject, audit };
1863
+ }
1864
+ if (response.status !== 200) {
1865
+ return unknown(subject, audit, "serverError", `The policy service answered ${response.status}; only 200 carries a policy and only 204 means none is published.`);
1866
+ }
1867
+ const contentType = response.headers.get("content-type");
1868
+ if (!JSON_MIME.test(contentType ?? "")) {
1869
+ return unknown(subject, audit, "notJson", `Expected a JSON policy document, got content-type ${contentType ?? "(none)"}.`);
1870
+ }
1871
+ const body = await response.text();
1872
+ if (!isJsonObject(body)) {
1873
+ return unknown(subject, audit, "notJson", body.trim() === "" ? "The response body was empty." : "The response body is not a JSON object.");
1874
+ }
1875
+ return { outcome: "governed", subject, audit, document: body };
1876
+ }
1877
+ function classifyFailure(error, subject, url, now, timedOut, signal, seenResponse) {
1878
+ if (error instanceof ResponseError) {
1879
+ return unknown(subject, buildAudit(url, now, error.response), reasonForStatus(error.response.status), `The policy service answered ${error.response.status}.`);
1880
+ }
1881
+ const audit = buildAudit(url, now, seenResponse);
1882
+ if (timedOut) {
1883
+ return unknown(subject, audit, "timedOut", "The policy service did not answer within the timeout.");
1884
+ }
1885
+ if (signal?.aborted || isAbortError(error)) {
1886
+ return unknown(subject, audit, "cancelled", "The request was cancelled.");
1887
+ }
1888
+ return unknown(subject, audit, "transport", `The request to the policy service failed: ${describe(unwrap(error))}`);
1889
+ }
1890
+ function unwrap(error) {
1891
+ return error instanceof FetchError ? error.cause : error;
1892
+ }
1893
+ function reasonForStatus(status) {
1894
+ if (status === 401 || status === 403) {
1895
+ return "unauthorized";
1896
+ }
1897
+ if (status === 404) {
1898
+ return "notFound";
1899
+ }
1900
+ return "serverError";
1901
+ }
1902
+ function buildAudit(url, now, response) {
1903
+ const audit = { url, resolvedAt: now().toISOString() };
1904
+ if (response) {
1905
+ audit.httpStatus = response.status;
1906
+ const retryAfter = parseRetryAfter(response.headers.get("retry-after"), now);
1907
+ if (retryAfter !== undefined) {
1908
+ audit.retryAfterSeconds = retryAfter;
1909
+ }
1910
+ }
1911
+ return audit;
1912
+ }
1913
+ function parseRetryAfter(header, now) {
1914
+ if (header === null || header.trim() === "") {
1915
+ return;
1916
+ }
1917
+ const seconds = Number(header.trim());
1918
+ if (Number.isInteger(seconds) && seconds >= 0) {
1919
+ return seconds;
1920
+ }
1921
+ const at = Date.parse(header);
1922
+ if (Number.isNaN(at)) {
1923
+ return;
1924
+ }
1925
+ return Math.max(0, Math.round((at - now().getTime()) / 1000));
1926
+ }
1927
+ function isJsonObject(body) {
1928
+ if (body.trim() === "") {
1929
+ return false;
1930
+ }
1931
+ let parsed;
1932
+ try {
1933
+ parsed = JSON.parse(body);
1934
+ } catch {
1935
+ return false;
1936
+ }
1937
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed);
1938
+ }
1939
+ function unknown(subject, audit, reason, detail) {
1940
+ return { outcome: "unknown", subject, audit, reason, detail };
1941
+ }
1942
+ async function readToken(accessToken) {
1943
+ return typeof accessToken === "function" ? await accessToken() : accessToken;
1944
+ }
1945
+ function isAbortError(error) {
1946
+ const candidate = error instanceof Error && "cause" in error && error.cause instanceof Error ? error.cause : error;
1947
+ return candidate instanceof Error && candidate.name === "AbortError";
1948
+ }
1949
+ function describe(error) {
1950
+ return error instanceof Error ? error.message : String(error);
1951
+ }
1952
+ function requireValue(field, value) {
1953
+ if (value === undefined || value === null) {
1954
+ throw new RequiredError(field, `Required option "${field}" is missing.`);
1955
+ }
1956
+ }
1957
+ function requireText(field, value) {
1958
+ requireValue(field, value);
1959
+ if (typeof value !== "string" || value.trim() === "") {
1960
+ throw new RequiredError(field, `Required option "${field}" must be a non-empty string.`);
1961
+ }
1962
+ }
1963
+ export {
1964
+ CLIENT_VERSION_HEADER,
1965
+ DEFAULT_TIMEOUT_MS,
1966
+ resolvePolicyAsync
1967
+ };
1968
+
1969
+ //# debugId=480264F18D5EE75E64756E2164756E21