@vcd/sdk 15.0.4 → 15.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/client/index.d.ts +1 -0
- package/client/client/types.d.ts +9 -0
- package/client/client/vcd.api.client.d.ts +1 -1
- package/client/client/vcd.http.client.d.ts +6 -4
- package/common/container-hooks.d.ts +4 -0
- package/core/plugin.module.d.ts +6 -0
- package/esm2020/client/client/index.mjs +2 -1
- package/esm2020/client/client/types.mjs +13 -0
- package/esm2020/client/client/vcd.api.client.mjs +12 -12
- package/esm2020/client/client/vcd.http.client.mjs +16 -7
- package/esm2020/common/container-hooks.mjs +1 -1
- package/esm2020/core/plugin.module.mjs +6 -1
- package/esm2020/main.mjs +2 -2
- package/fesm2015/vcd-sdk.mjs +145 -174
- package/fesm2015/vcd-sdk.mjs.map +1 -1
- package/fesm2020/vcd-sdk.mjs +143 -174
- package/fesm2020/vcd-sdk.mjs.map +1 -1
- package/main.d.ts +1 -1
- package/{open_source_license_@vcdsdk_15.0.4_GA.txt → open_source_license_@vcdsdk_15.0.6_GA.txt} +37 -19
- package/package.json +1 -1
- package/client/container-hooks/index.d.ts +0 -58
- package/esm2020/client/container-hooks/index.mjs +0 -57
- /package/{VMware-vcd_ui_sdk-15.0.4-ODP.tar.gz → VMware-vcd_ui_sdk-15.0.6-ODP.tar.gz} +0 -0
package/fesm2020/vcd-sdk.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common/http';
|
|
2
2
|
import { HttpResponse, HttpClient, HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, Optional,
|
|
4
|
+
import { Injectable, InjectionToken, Optional, Inject, NgModule } from '@angular/core';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
6
6
|
import { tap, finalize, map, catchError, switchMap, retry, flatMap, skipWhile, share, concatMap, filter, withLatestFrom } from 'rxjs/operators';
|
|
7
7
|
import { Observable, throwError, BehaviorSubject, of, ReplaySubject, merge } from 'rxjs';
|
|
@@ -322,6 +322,111 @@ class ApiResult {
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
/**
|
|
326
|
+
* This is the currently supported - albeit very minimal - public SDK.
|
|
327
|
+
*/
|
|
328
|
+
// Bind straight into the hooks provided by the container.
|
|
329
|
+
if (!window.System || !window.System.registry || !window.System.registry.get) {
|
|
330
|
+
throw new Error('SystemJS registry not found');
|
|
331
|
+
}
|
|
332
|
+
let containerHooks = window.System.registry.get('@vcd/common');
|
|
333
|
+
if (!containerHooks) {
|
|
334
|
+
containerHooks = window.System.registry.get('@vcd-ui/common');
|
|
335
|
+
}
|
|
336
|
+
if (!containerHooks) {
|
|
337
|
+
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
341
|
+
* or the single-cell URL).
|
|
342
|
+
*/
|
|
343
|
+
const API_ROOT_URL = containerHooks.API_ROOT_URL;
|
|
344
|
+
/**
|
|
345
|
+
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
346
|
+
*/
|
|
347
|
+
const FLEX_APP_URL = containerHooks.API_ROOT_URL;
|
|
348
|
+
/**
|
|
349
|
+
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
350
|
+
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
351
|
+
*/
|
|
352
|
+
const SESSION_SCOPE = containerHooks.SESSION_SCOPE;
|
|
353
|
+
/**
|
|
354
|
+
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
355
|
+
* organization that the VCD-UI is being used for.
|
|
356
|
+
*/
|
|
357
|
+
const SESSION_ORGANIZATION = containerHooks.SESSION_ORGANIZATION;
|
|
358
|
+
/**
|
|
359
|
+
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
360
|
+
* organization that the VCD-UI is being used for.
|
|
361
|
+
*/
|
|
362
|
+
const SESSION_ORG_ID = containerHooks.SESSION_ORG_ID ? containerHooks.SESSION_ORG_ID : '';
|
|
363
|
+
/**
|
|
364
|
+
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
365
|
+
*
|
|
366
|
+
* ATTENTION!
|
|
367
|
+
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
368
|
+
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
369
|
+
*/
|
|
370
|
+
const EXTENSION_ASSET_URL = containerHooks.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
371
|
+
/**
|
|
372
|
+
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
373
|
+
*/
|
|
374
|
+
const EXTENSION_ROUTE = containerHooks.EXTENSION_ROUTE;
|
|
375
|
+
/**
|
|
376
|
+
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
377
|
+
*/
|
|
378
|
+
const SDK_MODE = containerHooks.SDK_MODE;
|
|
379
|
+
const ExtensionNavRegistrationAction = containerHooks.ExtensionNavRegistrationAction;
|
|
380
|
+
const AuthTokenHolderService = containerHooks.AuthTokenHolderService;
|
|
381
|
+
/**
|
|
382
|
+
* Every component referenced by an entity action extension point must inherit from this.
|
|
383
|
+
*/
|
|
384
|
+
// tslint:disable-next-line:class-name
|
|
385
|
+
class _EntityActionExtensionComponent {
|
|
386
|
+
}
|
|
387
|
+
const EntityActionExtensionComponent = containerHooks.EntityActionExtensionComponent;
|
|
388
|
+
// tslint:disable-next-line:class-name
|
|
389
|
+
class _WizardExtensionComponent {
|
|
390
|
+
}
|
|
391
|
+
const WizardExtensionComponent = containerHooks.WizardExtensionComponent;
|
|
392
|
+
// tslint:disable-next-line:class-name
|
|
393
|
+
class _WizardExtensionWithValidationComponent extends _WizardExtensionComponent {
|
|
394
|
+
}
|
|
395
|
+
// tslint:disable-next-line:max-line-length
|
|
396
|
+
const WizardExtensionWithValidationComponent = containerHooks.WizardExtensionWithValidationComponent;
|
|
397
|
+
/**
|
|
398
|
+
* Every component-based Extension Point that is renderd in Cloud Director UI Entity Details
|
|
399
|
+
* must extend that class to obtain context about the Entity.
|
|
400
|
+
*
|
|
401
|
+
* See comments of the methods of the abstract class for more information.
|
|
402
|
+
*/
|
|
403
|
+
// tslint:disable-next-line:class-name
|
|
404
|
+
class _WizardExtensionWithContextComponent extends _WizardExtensionComponent {
|
|
405
|
+
}
|
|
406
|
+
// tslint:disable-next-line:max-line-length
|
|
407
|
+
const WizardExtensionWithContextComponent = containerHooks.WizardExtensionWithContextComponent;
|
|
408
|
+
|
|
409
|
+
class PluginModule {
|
|
410
|
+
constructor(appStore) {
|
|
411
|
+
this.appStore = appStore;
|
|
412
|
+
}
|
|
413
|
+
registerExtension(extension) {
|
|
414
|
+
this.appStore.dispatch(new ExtensionNavRegistrationAction(extension));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Config object that is passed on VcdSdkModule init
|
|
419
|
+
* using .forRoot() method. It can be used to store
|
|
420
|
+
* configutration properties that are later used by the Services
|
|
421
|
+
* provided.
|
|
422
|
+
*/
|
|
423
|
+
class VcdSdkConfig {
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Use this token for injecting custom HttpInterceptor implementations inside the HttpClient
|
|
427
|
+
*/
|
|
428
|
+
const VCD_HTTP_INTERCEPTORS = new InjectionToken("VCD_HTTP_INTERCEPTORS");
|
|
429
|
+
|
|
325
430
|
// tslint:disable:variable-name
|
|
326
431
|
class LoggingInterceptor {
|
|
327
432
|
set enabled(enabled) {
|
|
@@ -536,83 +641,35 @@ class VcdHttpClient extends HttpClient {
|
|
|
536
641
|
/**
|
|
537
642
|
* Create an HttpClient with the logging and header interceptors in the chain.
|
|
538
643
|
* @param httpBackend backend (likely injected from HttpClientModule)
|
|
539
|
-
* @param hateoasHeaderInterceptor the hateoas header interceptor
|
|
540
644
|
* @param loggingInterceptor the logging interceptor
|
|
541
645
|
* @param requestHeadersInterceptor the request header interceptor
|
|
646
|
+
* @param responseNormalizationInterceptor
|
|
647
|
+
* @param customInterceptors
|
|
542
648
|
*/
|
|
543
|
-
constructor(httpBackend, loggingInterceptor, requestHeadersInterceptor, responseNormalizationInterceptor) {
|
|
649
|
+
constructor(httpBackend, loggingInterceptor, requestHeadersInterceptor, responseNormalizationInterceptor, customInterceptors) {
|
|
544
650
|
const interceptors = [
|
|
545
651
|
loggingInterceptor,
|
|
546
652
|
requestHeadersInterceptor,
|
|
547
|
-
responseNormalizationInterceptor
|
|
653
|
+
responseNormalizationInterceptor,
|
|
654
|
+
...(customInterceptors ?? []),
|
|
548
655
|
];
|
|
549
656
|
const chain = interceptors.reduceRight((next, interceptor) => new VcdHttpInterceptorHandler(next, interceptor), httpBackend);
|
|
550
657
|
super(chain);
|
|
658
|
+
this.customInterceptors = customInterceptors;
|
|
551
659
|
this.loggingInterceptor = loggingInterceptor;
|
|
552
660
|
this.requestHeadersInterceptor = requestHeadersInterceptor;
|
|
553
661
|
}
|
|
554
662
|
}
|
|
555
|
-
VcdHttpClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient, deps: [{ token: i1.HttpBackend }, { token: LoggingInterceptor }, { token: RequestHeadersInterceptor }, { token: ResponseNormalizationInterceptor }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
663
|
+
VcdHttpClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient, deps: [{ token: i1.HttpBackend }, { token: LoggingInterceptor }, { token: RequestHeadersInterceptor }, { token: ResponseNormalizationInterceptor }, { token: VCD_HTTP_INTERCEPTORS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
556
664
|
VcdHttpClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient });
|
|
557
665
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient, decorators: [{
|
|
558
666
|
type: Injectable
|
|
559
|
-
}], ctorParameters: function () { return [{ type: i1.HttpBackend }, { type: LoggingInterceptor }, { type: RequestHeadersInterceptor }, { type: ResponseNormalizationInterceptor }
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
if (!window.System || !window.System.registry || !window.System.registry.get) {
|
|
566
|
-
throw new Error('SystemJS registry not found');
|
|
567
|
-
}
|
|
568
|
-
let containerHooks$1 = window.System.registry.get('@vcd/common');
|
|
569
|
-
if (!containerHooks$1) {
|
|
570
|
-
containerHooks$1 = window.System.registry.get('@vcd-ui/common');
|
|
571
|
-
}
|
|
572
|
-
if (!containerHooks$1) {
|
|
573
|
-
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
577
|
-
* or the single-cell URL).
|
|
578
|
-
*/
|
|
579
|
-
const API_ROOT_URL$1 = containerHooks$1.API_ROOT_URL;
|
|
580
|
-
/**
|
|
581
|
-
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
582
|
-
*/
|
|
583
|
-
const FLEX_APP_URL$1 = containerHooks$1.API_ROOT_URL;
|
|
584
|
-
/**
|
|
585
|
-
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
586
|
-
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
587
|
-
*/
|
|
588
|
-
const SESSION_SCOPE$1 = containerHooks$1.SESSION_SCOPE;
|
|
589
|
-
/**
|
|
590
|
-
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
591
|
-
* organization that the VCD-UI is being used for.
|
|
592
|
-
*/
|
|
593
|
-
const SESSION_ORGANIZATION$1 = containerHooks$1.SESSION_ORGANIZATION;
|
|
594
|
-
/**
|
|
595
|
-
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
596
|
-
* organization that the VCD-UI is being used for.
|
|
597
|
-
*/
|
|
598
|
-
const SESSION_ORG_ID$1 = containerHooks$1.SESSION_ORG_ID ? containerHooks$1.SESSION_ORG_ID : '';
|
|
599
|
-
/**
|
|
600
|
-
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
601
|
-
*
|
|
602
|
-
* ATTENTION!
|
|
603
|
-
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
604
|
-
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
605
|
-
*/
|
|
606
|
-
const EXTENSION_ASSET_URL$1 = containerHooks$1.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
607
|
-
/**
|
|
608
|
-
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
609
|
-
*/
|
|
610
|
-
const EXTENSION_ROUTE$1 = containerHooks$1.EXTENSION_ROUTE;
|
|
611
|
-
/**
|
|
612
|
-
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
613
|
-
*/
|
|
614
|
-
const SDK_MODE$1 = containerHooks$1.SDK_MODE;
|
|
615
|
-
const AuthTokenHolderService$1 = containerHooks$1.AuthTokenHolderService;
|
|
667
|
+
}], ctorParameters: function () { return [{ type: i1.HttpBackend }, { type: LoggingInterceptor }, { type: RequestHeadersInterceptor }, { type: ResponseNormalizationInterceptor }, { type: undefined, decorators: [{
|
|
668
|
+
type: Optional
|
|
669
|
+
}, {
|
|
670
|
+
type: Inject,
|
|
671
|
+
args: [VCD_HTTP_INTERCEPTORS]
|
|
672
|
+
}] }]; } });
|
|
616
673
|
|
|
617
674
|
/**
|
|
618
675
|
* Default chunk size is 50MiB. This is equal to the chunk size the VCD UI uses for library uploads.
|
|
@@ -777,106 +834,18 @@ class VcdTransferClient {
|
|
|
777
834
|
}
|
|
778
835
|
}
|
|
779
836
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
throw new Error('SystemJS registry not found');
|
|
786
|
-
}
|
|
787
|
-
let containerHooks = window.System.registry.get('@vcd/common');
|
|
788
|
-
if (!containerHooks) {
|
|
789
|
-
containerHooks = window.System.registry.get('@vcd-ui/common');
|
|
790
|
-
}
|
|
791
|
-
if (!containerHooks) {
|
|
792
|
-
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
796
|
-
* or the single-cell URL).
|
|
797
|
-
*/
|
|
798
|
-
const API_ROOT_URL = containerHooks.API_ROOT_URL;
|
|
799
|
-
/**
|
|
800
|
-
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
801
|
-
*/
|
|
802
|
-
const FLEX_APP_URL = containerHooks.API_ROOT_URL;
|
|
803
|
-
/**
|
|
804
|
-
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
805
|
-
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
806
|
-
*/
|
|
807
|
-
const SESSION_SCOPE = containerHooks.SESSION_SCOPE;
|
|
808
|
-
/**
|
|
809
|
-
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
810
|
-
* organization that the VCD-UI is being used for.
|
|
811
|
-
*/
|
|
812
|
-
const SESSION_ORGANIZATION = containerHooks.SESSION_ORGANIZATION;
|
|
813
|
-
/**
|
|
814
|
-
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
815
|
-
* organization that the VCD-UI is being used for.
|
|
816
|
-
*/
|
|
817
|
-
const SESSION_ORG_ID = containerHooks.SESSION_ORG_ID ? containerHooks.SESSION_ORG_ID : '';
|
|
818
|
-
/**
|
|
819
|
-
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
820
|
-
*
|
|
821
|
-
* ATTENTION!
|
|
822
|
-
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
823
|
-
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
824
|
-
*/
|
|
825
|
-
const EXTENSION_ASSET_URL = containerHooks.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
826
|
-
/**
|
|
827
|
-
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
828
|
-
*/
|
|
829
|
-
const EXTENSION_ROUTE = containerHooks.EXTENSION_ROUTE;
|
|
830
|
-
/**
|
|
831
|
-
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
832
|
-
*/
|
|
833
|
-
const SDK_MODE = containerHooks.SDK_MODE;
|
|
834
|
-
const ExtensionNavRegistrationAction = containerHooks.ExtensionNavRegistrationAction;
|
|
835
|
-
const AuthTokenHolderService = containerHooks.AuthTokenHolderService;
|
|
836
|
-
/**
|
|
837
|
-
* Every component referenced by an entity action extension point must inherit from this.
|
|
838
|
-
*/
|
|
839
|
-
// tslint:disable-next-line:class-name
|
|
840
|
-
class _EntityActionExtensionComponent {
|
|
841
|
-
}
|
|
842
|
-
const EntityActionExtensionComponent = containerHooks.EntityActionExtensionComponent;
|
|
843
|
-
// tslint:disable-next-line:class-name
|
|
844
|
-
class _WizardExtensionComponent {
|
|
845
|
-
}
|
|
846
|
-
const WizardExtensionComponent = containerHooks.WizardExtensionComponent;
|
|
847
|
-
// tslint:disable-next-line:class-name
|
|
848
|
-
class _WizardExtensionWithValidationComponent extends _WizardExtensionComponent {
|
|
849
|
-
}
|
|
850
|
-
// tslint:disable-next-line:max-line-length
|
|
851
|
-
const WizardExtensionWithValidationComponent = containerHooks.WizardExtensionWithValidationComponent;
|
|
852
|
-
/**
|
|
853
|
-
* Every component-based Extension Point that is renderd in Cloud Director UI Entity Details
|
|
854
|
-
* must extend that class to obtain context about the Entity.
|
|
855
|
-
*
|
|
856
|
-
* See comments of the methods of the abstract class for more information.
|
|
857
|
-
*/
|
|
858
|
-
// tslint:disable-next-line:class-name
|
|
859
|
-
class _WizardExtensionWithContextComponent extends _WizardExtensionComponent {
|
|
860
|
-
}
|
|
861
|
-
// tslint:disable-next-line:max-line-length
|
|
862
|
-
const WizardExtensionWithContextComponent = containerHooks.WizardExtensionWithContextComponent;
|
|
863
|
-
|
|
864
|
-
class PluginModule {
|
|
865
|
-
constructor(appStore) {
|
|
866
|
-
this.appStore = appStore;
|
|
867
|
-
}
|
|
868
|
-
registerExtension(extension) {
|
|
869
|
-
this.appStore.dispatch(new ExtensionNavRegistrationAction(extension));
|
|
837
|
+
class ClientError extends Error {
|
|
838
|
+
constructor(message, type) {
|
|
839
|
+
super(message);
|
|
840
|
+
this.message = message;
|
|
841
|
+
this.type = type;
|
|
870
842
|
}
|
|
871
843
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
*/
|
|
878
|
-
class VcdSdkConfig {
|
|
879
|
-
}
|
|
844
|
+
var ClientErrorType;
|
|
845
|
+
(function (ClientErrorType) {
|
|
846
|
+
ClientErrorType["HateoasLinkMissing"] = "HateoasLinkMissing";
|
|
847
|
+
ClientErrorType["TaskLinkMissing"] = "TaskLinkMissing";
|
|
848
|
+
})(ClientErrorType || (ClientErrorType = {}));
|
|
880
849
|
|
|
881
850
|
const TRANSFER_LINK_REL = 'upload:default';
|
|
882
851
|
const HATEOAS_HEADER = 'Link';
|
|
@@ -995,7 +964,7 @@ class VcdApiClient {
|
|
|
995
964
|
* In this case the old API (/api/session) should not be used at all.
|
|
996
965
|
*/
|
|
997
966
|
this._isCloudApiLogin = false;
|
|
998
|
-
this._baseUrl = this.injector.get(API_ROOT_URL
|
|
967
|
+
this._baseUrl = this.injector.get(API_ROOT_URL);
|
|
999
968
|
let negotiatedVersion;
|
|
1000
969
|
if (this.config?.apiVersion) {
|
|
1001
970
|
negotiatedVersion = of(this.config.apiVersion).pipe(map((version) => {
|
|
@@ -1007,7 +976,7 @@ class VcdApiClient {
|
|
|
1007
976
|
negotiatedVersion = this.http.get(`${this._baseUrl}/api/versions`).pipe(map(versions => this.negotiateVersion(versions)), tap(version => this.setVersion(version)));
|
|
1008
977
|
}
|
|
1009
978
|
this._negotiateVersion = negotiatedVersion.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
1010
|
-
const tokenHolder = this.injector.get(AuthTokenHolderService
|
|
979
|
+
const tokenHolder = this.injector.get(AuthTokenHolderService, { token: '' });
|
|
1011
980
|
const token = tokenHolder.jwt ? `Bearer ${tokenHolder.jwt}` : tokenHolder.token;
|
|
1012
981
|
this._getSession = this.setAuthentication(token)
|
|
1013
982
|
.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
@@ -1087,10 +1056,10 @@ class VcdApiClient {
|
|
|
1087
1056
|
this.http.requestHeadersInterceptor.authentication = authentication;
|
|
1088
1057
|
return this.http.get(`${this._baseUrl}/api/session`).pipe(tap(session => {
|
|
1089
1058
|
// automatically set actAs for provider in tenant scope
|
|
1090
|
-
if (session.org === 'System' && this.injector.get(SESSION_SCOPE
|
|
1059
|
+
if (session.org === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1091
1060
|
// Automatic actAs only works in versions >=9.5
|
|
1092
1061
|
try {
|
|
1093
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1062
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1094
1063
|
}
|
|
1095
1064
|
catch (e) {
|
|
1096
1065
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1199,10 +1168,10 @@ class VcdApiClient {
|
|
|
1199
1168
|
// Clear previous actAs
|
|
1200
1169
|
this.actAs(null);
|
|
1201
1170
|
// automatically set actAs for provider in tenant scope
|
|
1202
|
-
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE
|
|
1171
|
+
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1203
1172
|
// Automatic actAs only works in versions >=9.5
|
|
1204
1173
|
try {
|
|
1205
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1174
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1206
1175
|
}
|
|
1207
1176
|
catch (e) {
|
|
1208
1177
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1264,7 +1233,7 @@ class VcdApiClient {
|
|
|
1264
1233
|
const link = [...headerLinks, ...links]
|
|
1265
1234
|
.find((l) => l.rel === transferRel);
|
|
1266
1235
|
if (!link) {
|
|
1267
|
-
throw new
|
|
1236
|
+
throw new ClientError(`Response from ${endpoint} did not contain a transfer link`, ClientErrorType.HateoasLinkMissing);
|
|
1268
1237
|
}
|
|
1269
1238
|
return link.href;
|
|
1270
1239
|
}));
|
|
@@ -1293,7 +1262,7 @@ class VcdApiClient {
|
|
|
1293
1262
|
const task = Object.assign(new TaskType(), response.body);
|
|
1294
1263
|
return of(task);
|
|
1295
1264
|
}
|
|
1296
|
-
return throwError(() => new
|
|
1265
|
+
return throwError(() => new ClientError(`An asynchronous request was made to [${httpVerb} ${response.url}], but no task was returned. The operation may still have been successful.`, ClientErrorType.TaskLinkMissing));
|
|
1297
1266
|
}
|
|
1298
1267
|
getEntity(entityRefOrUrn) {
|
|
1299
1268
|
const entityResolver = typeof entityRefOrUrn === 'string' ?
|
|
@@ -1310,7 +1279,7 @@ class VcdApiClient {
|
|
|
1310
1279
|
removeItem(item, options) {
|
|
1311
1280
|
const link = this.findLink(item, 'remove', null);
|
|
1312
1281
|
if (!link) {
|
|
1313
|
-
return throwError(() => new
|
|
1282
|
+
return throwError(() => new ClientError(`No 'remove' link for specified resource.`, ClientErrorType.HateoasLinkMissing));
|
|
1314
1283
|
}
|
|
1315
1284
|
return this.validateRequestContext().pipe(concatMap(() => this.http.delete(link.href, { ...options })));
|
|
1316
1285
|
}
|
|
@@ -1320,7 +1289,7 @@ class VcdApiClient {
|
|
|
1320
1289
|
firstPage(result, multisite, options) {
|
|
1321
1290
|
const link = this.findLink(result, 'firstPage', result.type);
|
|
1322
1291
|
if (!link) {
|
|
1323
|
-
return throwError(() => new
|
|
1292
|
+
return throwError(() => new ClientError(`No 'firstPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1324
1293
|
}
|
|
1325
1294
|
return this.getQueryPage(link.href, multisite, options);
|
|
1326
1295
|
}
|
|
@@ -1330,7 +1299,7 @@ class VcdApiClient {
|
|
|
1330
1299
|
previousPage(result, multisite, options) {
|
|
1331
1300
|
const link = this.findLink(result, 'previousPage', result.type);
|
|
1332
1301
|
if (!link) {
|
|
1333
|
-
return throwError(() => new
|
|
1302
|
+
return throwError(() => new ClientError(`No 'previousPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1334
1303
|
}
|
|
1335
1304
|
return this.getQueryPage(link.href, multisite, options);
|
|
1336
1305
|
}
|
|
@@ -1340,7 +1309,7 @@ class VcdApiClient {
|
|
|
1340
1309
|
nextPage(result, multisite, options) {
|
|
1341
1310
|
const link = this.findLink(result, 'nextPage', result.type);
|
|
1342
1311
|
if (!link) {
|
|
1343
|
-
return throwError(() => new
|
|
1312
|
+
return throwError(() => new ClientError(`No 'nextPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1344
1313
|
}
|
|
1345
1314
|
return this.getQueryPage(link.href, multisite, options);
|
|
1346
1315
|
}
|
|
@@ -1350,7 +1319,7 @@ class VcdApiClient {
|
|
|
1350
1319
|
lastPage(result, multisite, options) {
|
|
1351
1320
|
const link = this.findLink(result, 'lastPage', result.type);
|
|
1352
1321
|
if (!link) {
|
|
1353
|
-
return throwError(() => new
|
|
1322
|
+
return throwError(() => new ClientError(`No 'lastPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1354
1323
|
}
|
|
1355
1324
|
return this.getQueryPage(link.href, multisite, options);
|
|
1356
1325
|
}
|
|
@@ -1515,5 +1484,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
1515
1484
|
* Generated bundle index. Do not edit.
|
|
1516
1485
|
*/
|
|
1517
1486
|
|
|
1518
|
-
export { API_ROOT_URL, ApiResult, ApiResultService, AuthTokenHolderService, EXTENSION_ASSET_URL, EXTENSION_ROUTE, EntityActionExtensionComponent, ExtensionNavRegistrationAction, FLEX_APP_URL, Filter, HATEOAS_HEADER, LinkRelType, LoggingInterceptor, MAX_CHUNK_RETRY_COUNT, MAX_CHUNK_SIZE, PluginModule, Query, RequestHeadersInterceptor, ResponseNormalizationInterceptor, SDK_MODE, SESSION_ORGANIZATION, SESSION_ORG_ID, SESSION_SCOPE, TRANSFER_LINK_REL, TransferError, VcdApiClient, VcdHttpClient, VcdSdkConfig, VcdSdkModule, VcdTransferClient, WizardExtensionComponent, WizardExtensionWithContextComponent, WizardExtensionWithValidationComponent, _EntityActionExtensionComponent, _WizardExtensionComponent, _WizardExtensionWithContextComponent, _WizardExtensionWithValidationComponent, parseHeaderHateoasLinks };
|
|
1487
|
+
export { API_ROOT_URL, ApiResult, ApiResultService, AuthTokenHolderService, ClientError, ClientErrorType, EXTENSION_ASSET_URL, EXTENSION_ROUTE, EntityActionExtensionComponent, ExtensionNavRegistrationAction, FLEX_APP_URL, Filter, HATEOAS_HEADER, LinkRelType, LoggingInterceptor, MAX_CHUNK_RETRY_COUNT, MAX_CHUNK_SIZE, PluginModule, Query, RequestHeadersInterceptor, ResponseNormalizationInterceptor, SDK_MODE, SESSION_ORGANIZATION, SESSION_ORG_ID, SESSION_SCOPE, TRANSFER_LINK_REL, TransferError, VCD_HTTP_INTERCEPTORS, VcdApiClient, VcdHttpClient, VcdSdkConfig, VcdSdkModule, VcdTransferClient, WizardExtensionComponent, WizardExtensionWithContextComponent, WizardExtensionWithValidationComponent, _EntityActionExtensionComponent, _WizardExtensionComponent, _WizardExtensionWithContextComponent, _WizardExtensionWithValidationComponent, parseHeaderHateoasLinks };
|
|
1519
1488
|
//# sourceMappingURL=vcd-sdk.mjs.map
|