@vcd/sdk 15.0.3 → 15.0.5
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/VMware-vcd_ui_sdk-15.0.4-ODP.tar.gz +0 -0
- 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 +16 -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 +12 -1
- package/esm2020/core/plugin.module.mjs +6 -1
- package/esm2020/main.mjs +2 -2
- package/fesm2015/vcd-sdk.mjs +158 -120
- package/fesm2015/vcd-sdk.mjs.map +1 -1
- package/fesm2020/vcd-sdk.mjs +156 -120
- package/fesm2020/vcd-sdk.mjs.map +1 -1
- package/main.d.ts +1 -1
- package/{open_source_license_vcd_ui_sdk_15.0.3.txt → open_source_license_@vcdsdk_15.0.4_GA.txt} +33 -28
- package/package.json +1 -1
- package/VMware-vcd_ui_sdk-15.0.3-ODP.tar.gz +0 -0
package/fesm2015/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$1 = window.System.registry.get('@vcd/common');
|
|
333
|
+
if (!containerHooks$1) {
|
|
334
|
+
containerHooks$1 = window.System.registry.get('@vcd-ui/common');
|
|
335
|
+
}
|
|
336
|
+
if (!containerHooks$1) {
|
|
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$1 = containerHooks$1.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$1 = containerHooks$1.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$1 = containerHooks$1.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$1 = containerHooks$1.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$1 = containerHooks$1.SESSION_ORG_ID ? containerHooks$1.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$1 = containerHooks$1.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$1 = containerHooks$1.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$1 = containerHooks$1.SDK_MODE;
|
|
379
|
+
const ExtensionNavRegistrationAction = containerHooks$1.ExtensionNavRegistrationAction;
|
|
380
|
+
const AuthTokenHolderService$1 = containerHooks$1.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$1.EntityActionExtensionComponent;
|
|
388
|
+
// tslint:disable-next-line:class-name
|
|
389
|
+
class _WizardExtensionComponent {
|
|
390
|
+
}
|
|
391
|
+
const WizardExtensionComponent = containerHooks$1.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$1.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$1.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) {
|
|
@@ -538,27 +643,37 @@ class VcdHttpClient extends HttpClient {
|
|
|
538
643
|
/**
|
|
539
644
|
* Create an HttpClient with the logging and header interceptors in the chain.
|
|
540
645
|
* @param httpBackend backend (likely injected from HttpClientModule)
|
|
541
|
-
* @param hateoasHeaderInterceptor the hateoas header interceptor
|
|
542
646
|
* @param loggingInterceptor the logging interceptor
|
|
543
647
|
* @param requestHeadersInterceptor the request header interceptor
|
|
648
|
+
* @param responseNormalizationInterceptor
|
|
649
|
+
* @param customInterceptors
|
|
544
650
|
*/
|
|
545
|
-
constructor(httpBackend, loggingInterceptor, requestHeadersInterceptor, responseNormalizationInterceptor) {
|
|
651
|
+
constructor(httpBackend, loggingInterceptor, requestHeadersInterceptor, responseNormalizationInterceptor, customInterceptors) {
|
|
546
652
|
const interceptors = [
|
|
547
653
|
loggingInterceptor,
|
|
548
654
|
requestHeadersInterceptor,
|
|
549
|
-
responseNormalizationInterceptor
|
|
655
|
+
responseNormalizationInterceptor,
|
|
656
|
+
...(customInterceptors !== null && customInterceptors !== void 0 ? customInterceptors : []),
|
|
550
657
|
];
|
|
551
658
|
const chain = interceptors.reduceRight((next, interceptor) => new VcdHttpInterceptorHandler(next, interceptor), httpBackend);
|
|
552
659
|
super(chain);
|
|
660
|
+
this.customInterceptors = customInterceptors;
|
|
553
661
|
this.loggingInterceptor = loggingInterceptor;
|
|
554
662
|
this.requestHeadersInterceptor = requestHeadersInterceptor;
|
|
555
663
|
}
|
|
556
664
|
}
|
|
557
|
-
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 });
|
|
665
|
+
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 });
|
|
558
666
|
VcdHttpClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient });
|
|
559
667
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: VcdHttpClient, decorators: [{
|
|
560
668
|
type: Injectable
|
|
561
|
-
}], ctorParameters: function () {
|
|
669
|
+
}], ctorParameters: function () {
|
|
670
|
+
return [{ type: i1.HttpBackend }, { type: LoggingInterceptor }, { type: RequestHeadersInterceptor }, { type: ResponseNormalizationInterceptor }, { type: undefined, decorators: [{
|
|
671
|
+
type: Optional
|
|
672
|
+
}, {
|
|
673
|
+
type: Inject,
|
|
674
|
+
args: [VCD_HTTP_INTERCEPTORS]
|
|
675
|
+
}] }];
|
|
676
|
+
} });
|
|
562
677
|
|
|
563
678
|
/**
|
|
564
679
|
* This is the currently supported - albeit very minimal - public SDK.
|
|
@@ -567,37 +682,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
567
682
|
if (!window.System || !window.System.registry || !window.System.registry.get) {
|
|
568
683
|
throw new Error('SystemJS registry not found');
|
|
569
684
|
}
|
|
570
|
-
let containerHooks
|
|
571
|
-
if (!containerHooks
|
|
572
|
-
containerHooks
|
|
685
|
+
let containerHooks = window.System.registry.get('@vcd/common');
|
|
686
|
+
if (!containerHooks) {
|
|
687
|
+
containerHooks = window.System.registry.get('@vcd-ui/common');
|
|
573
688
|
}
|
|
574
|
-
if (!containerHooks
|
|
689
|
+
if (!containerHooks) {
|
|
575
690
|
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
576
691
|
}
|
|
577
692
|
/**
|
|
578
693
|
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
579
694
|
* or the single-cell URL).
|
|
580
695
|
*/
|
|
581
|
-
const API_ROOT_URL
|
|
696
|
+
const API_ROOT_URL = containerHooks.API_ROOT_URL;
|
|
582
697
|
/**
|
|
583
698
|
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
584
699
|
*/
|
|
585
|
-
const FLEX_APP_URL
|
|
700
|
+
const FLEX_APP_URL = containerHooks.API_ROOT_URL;
|
|
586
701
|
/**
|
|
587
702
|
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
588
703
|
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
589
704
|
*/
|
|
590
|
-
const SESSION_SCOPE
|
|
705
|
+
const SESSION_SCOPE = containerHooks.SESSION_SCOPE;
|
|
591
706
|
/**
|
|
592
707
|
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
593
708
|
* organization that the VCD-UI is being used for.
|
|
594
709
|
*/
|
|
595
|
-
const SESSION_ORGANIZATION
|
|
710
|
+
const SESSION_ORGANIZATION = containerHooks.SESSION_ORGANIZATION;
|
|
596
711
|
/**
|
|
597
712
|
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
598
713
|
* organization that the VCD-UI is being used for.
|
|
599
714
|
*/
|
|
600
|
-
const SESSION_ORG_ID
|
|
715
|
+
const SESSION_ORG_ID = containerHooks.SESSION_ORG_ID ? containerHooks.SESSION_ORG_ID : '';
|
|
601
716
|
/**
|
|
602
717
|
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
603
718
|
*
|
|
@@ -605,16 +720,16 @@ const SESSION_ORG_ID$1 = containerHooks$1.SESSION_ORG_ID ? containerHooks$1.SESS
|
|
|
605
720
|
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
606
721
|
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
607
722
|
*/
|
|
608
|
-
const EXTENSION_ASSET_URL
|
|
723
|
+
const EXTENSION_ASSET_URL = containerHooks.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
609
724
|
/**
|
|
610
725
|
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
611
726
|
*/
|
|
612
|
-
const EXTENSION_ROUTE
|
|
727
|
+
const EXTENSION_ROUTE = containerHooks.EXTENSION_ROUTE;
|
|
613
728
|
/**
|
|
614
729
|
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
615
730
|
*/
|
|
616
|
-
const SDK_MODE
|
|
617
|
-
const AuthTokenHolderService
|
|
731
|
+
const SDK_MODE = containerHooks.SDK_MODE;
|
|
732
|
+
const AuthTokenHolderService = containerHooks.AuthTokenHolderService;
|
|
618
733
|
|
|
619
734
|
/**
|
|
620
735
|
* Default chunk size is 50MiB. This is equal to the chunk size the VCD UI uses for library uploads.
|
|
@@ -779,95 +894,18 @@ class VcdTransferClient {
|
|
|
779
894
|
}
|
|
780
895
|
}
|
|
781
896
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
throw new Error('SystemJS registry not found');
|
|
788
|
-
}
|
|
789
|
-
let containerHooks = window.System.registry.get('@vcd/common');
|
|
790
|
-
if (!containerHooks) {
|
|
791
|
-
containerHooks = window.System.registry.get('@vcd-ui/common');
|
|
792
|
-
}
|
|
793
|
-
if (!containerHooks) {
|
|
794
|
-
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
795
|
-
}
|
|
796
|
-
/**
|
|
797
|
-
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
798
|
-
* or the single-cell URL).
|
|
799
|
-
*/
|
|
800
|
-
const API_ROOT_URL = containerHooks.API_ROOT_URL;
|
|
801
|
-
/**
|
|
802
|
-
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
803
|
-
*/
|
|
804
|
-
const FLEX_APP_URL = containerHooks.API_ROOT_URL;
|
|
805
|
-
/**
|
|
806
|
-
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
807
|
-
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
808
|
-
*/
|
|
809
|
-
const SESSION_SCOPE = containerHooks.SESSION_SCOPE;
|
|
810
|
-
/**
|
|
811
|
-
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
812
|
-
* organization that the VCD-UI is being used for.
|
|
813
|
-
*/
|
|
814
|
-
const SESSION_ORGANIZATION = containerHooks.SESSION_ORGANIZATION;
|
|
815
|
-
/**
|
|
816
|
-
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
817
|
-
* organization that the VCD-UI is being used for.
|
|
818
|
-
*/
|
|
819
|
-
const SESSION_ORG_ID = containerHooks.SESSION_ORG_ID ? containerHooks.SESSION_ORG_ID : '';
|
|
820
|
-
/**
|
|
821
|
-
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
822
|
-
*
|
|
823
|
-
* ATTENTION!
|
|
824
|
-
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
825
|
-
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
826
|
-
*/
|
|
827
|
-
const EXTENSION_ASSET_URL = containerHooks.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
828
|
-
/**
|
|
829
|
-
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
830
|
-
*/
|
|
831
|
-
const EXTENSION_ROUTE = containerHooks.EXTENSION_ROUTE;
|
|
832
|
-
/**
|
|
833
|
-
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
834
|
-
*/
|
|
835
|
-
const SDK_MODE = containerHooks.SDK_MODE;
|
|
836
|
-
const ExtensionNavRegistrationAction = containerHooks.ExtensionNavRegistrationAction;
|
|
837
|
-
const AuthTokenHolderService = containerHooks.AuthTokenHolderService;
|
|
838
|
-
/**
|
|
839
|
-
* Every component referenced by an entity action extension point must inherit from this.
|
|
840
|
-
*/
|
|
841
|
-
// tslint:disable-next-line:class-name
|
|
842
|
-
class _EntityActionExtensionComponent {
|
|
843
|
-
}
|
|
844
|
-
const EntityActionExtensionComponent = containerHooks.EntityActionExtensionComponent;
|
|
845
|
-
// tslint:disable-next-line:class-name
|
|
846
|
-
class _WizardExtensionComponent {
|
|
847
|
-
}
|
|
848
|
-
const WizardExtensionComponent = containerHooks.WizardExtensionComponent;
|
|
849
|
-
// tslint:disable-next-line:class-name
|
|
850
|
-
class _WizardExtensionWithValidationComponent extends _WizardExtensionComponent {
|
|
851
|
-
}
|
|
852
|
-
// tslint:disable-next-line:max-line-length
|
|
853
|
-
const WizardExtensionWithValidationComponent = containerHooks.WizardExtensionWithValidationComponent;
|
|
854
|
-
|
|
855
|
-
class PluginModule {
|
|
856
|
-
constructor(appStore) {
|
|
857
|
-
this.appStore = appStore;
|
|
858
|
-
}
|
|
859
|
-
registerExtension(extension) {
|
|
860
|
-
this.appStore.dispatch(new ExtensionNavRegistrationAction(extension));
|
|
897
|
+
class ClientError extends Error {
|
|
898
|
+
constructor(message, type) {
|
|
899
|
+
super(message);
|
|
900
|
+
this.message = message;
|
|
901
|
+
this.type = type;
|
|
861
902
|
}
|
|
862
903
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
*/
|
|
869
|
-
class VcdSdkConfig {
|
|
870
|
-
}
|
|
904
|
+
var ClientErrorType;
|
|
905
|
+
(function (ClientErrorType) {
|
|
906
|
+
ClientErrorType["HateoasLinkMissing"] = "HateoasLinkMissing";
|
|
907
|
+
ClientErrorType["TaskLinkMissing"] = "TaskLinkMissing";
|
|
908
|
+
})(ClientErrorType || (ClientErrorType = {}));
|
|
871
909
|
|
|
872
910
|
const TRANSFER_LINK_REL = 'upload:default';
|
|
873
911
|
const HATEOAS_HEADER = 'Link';
|
|
@@ -987,7 +1025,7 @@ class VcdApiClient {
|
|
|
987
1025
|
* In this case the old API (/api/session) should not be used at all.
|
|
988
1026
|
*/
|
|
989
1027
|
this._isCloudApiLogin = false;
|
|
990
|
-
this._baseUrl = this.injector.get(API_ROOT_URL
|
|
1028
|
+
this._baseUrl = this.injector.get(API_ROOT_URL);
|
|
991
1029
|
let negotiatedVersion;
|
|
992
1030
|
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.apiVersion) {
|
|
993
1031
|
negotiatedVersion = of(this.config.apiVersion).pipe(map((version) => {
|
|
@@ -999,7 +1037,7 @@ class VcdApiClient {
|
|
|
999
1037
|
negotiatedVersion = this.http.get(`${this._baseUrl}/api/versions`).pipe(map(versions => this.negotiateVersion(versions)), tap(version => this.setVersion(version)));
|
|
1000
1038
|
}
|
|
1001
1039
|
this._negotiateVersion = negotiatedVersion.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
1002
|
-
const tokenHolder = this.injector.get(AuthTokenHolderService
|
|
1040
|
+
const tokenHolder = this.injector.get(AuthTokenHolderService, { token: '' });
|
|
1003
1041
|
const token = tokenHolder.jwt ? `Bearer ${tokenHolder.jwt}` : tokenHolder.token;
|
|
1004
1042
|
this._getSession = this.setAuthentication(token)
|
|
1005
1043
|
.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
@@ -1079,10 +1117,10 @@ class VcdApiClient {
|
|
|
1079
1117
|
this.http.requestHeadersInterceptor.authentication = authentication;
|
|
1080
1118
|
return this.http.get(`${this._baseUrl}/api/session`).pipe(tap(session => {
|
|
1081
1119
|
// automatically set actAs for provider in tenant scope
|
|
1082
|
-
if (session.org === 'System' && this.injector.get(SESSION_SCOPE
|
|
1120
|
+
if (session.org === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1083
1121
|
// Automatic actAs only works in versions >=9.5
|
|
1084
1122
|
try {
|
|
1085
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1123
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1086
1124
|
}
|
|
1087
1125
|
catch (e) {
|
|
1088
1126
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1191,10 +1229,10 @@ class VcdApiClient {
|
|
|
1191
1229
|
// Clear previous actAs
|
|
1192
1230
|
this.actAs(null);
|
|
1193
1231
|
// automatically set actAs for provider in tenant scope
|
|
1194
|
-
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE
|
|
1232
|
+
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1195
1233
|
// Automatic actAs only works in versions >=9.5
|
|
1196
1234
|
try {
|
|
1197
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1235
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1198
1236
|
}
|
|
1199
1237
|
catch (e) {
|
|
1200
1238
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1256,7 +1294,7 @@ class VcdApiClient {
|
|
|
1256
1294
|
const link = [...headerLinks, ...links]
|
|
1257
1295
|
.find((l) => l.rel === transferRel);
|
|
1258
1296
|
if (!link) {
|
|
1259
|
-
throw new
|
|
1297
|
+
throw new ClientError(`Response from ${endpoint} did not contain a transfer link`, ClientErrorType.HateoasLinkMissing);
|
|
1260
1298
|
}
|
|
1261
1299
|
return link.href;
|
|
1262
1300
|
}));
|
|
@@ -1285,7 +1323,7 @@ class VcdApiClient {
|
|
|
1285
1323
|
const task = Object.assign(new TaskType(), response.body);
|
|
1286
1324
|
return of(task);
|
|
1287
1325
|
}
|
|
1288
|
-
return throwError(() => new
|
|
1326
|
+
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));
|
|
1289
1327
|
}
|
|
1290
1328
|
getEntity(entityRefOrUrn) {
|
|
1291
1329
|
const entityResolver = typeof entityRefOrUrn === 'string' ?
|
|
@@ -1302,7 +1340,7 @@ class VcdApiClient {
|
|
|
1302
1340
|
removeItem(item, options) {
|
|
1303
1341
|
const link = this.findLink(item, 'remove', null);
|
|
1304
1342
|
if (!link) {
|
|
1305
|
-
return throwError(() => new
|
|
1343
|
+
return throwError(() => new ClientError(`No 'remove' link for specified resource.`, ClientErrorType.HateoasLinkMissing));
|
|
1306
1344
|
}
|
|
1307
1345
|
return this.validateRequestContext().pipe(concatMap(() => this.http.delete(link.href, Object.assign({}, options))));
|
|
1308
1346
|
}
|
|
@@ -1312,7 +1350,7 @@ class VcdApiClient {
|
|
|
1312
1350
|
firstPage(result, multisite, options) {
|
|
1313
1351
|
const link = this.findLink(result, 'firstPage', result.type);
|
|
1314
1352
|
if (!link) {
|
|
1315
|
-
return throwError(() => new
|
|
1353
|
+
return throwError(() => new ClientError(`No 'firstPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1316
1354
|
}
|
|
1317
1355
|
return this.getQueryPage(link.href, multisite, options);
|
|
1318
1356
|
}
|
|
@@ -1322,7 +1360,7 @@ class VcdApiClient {
|
|
|
1322
1360
|
previousPage(result, multisite, options) {
|
|
1323
1361
|
const link = this.findLink(result, 'previousPage', result.type);
|
|
1324
1362
|
if (!link) {
|
|
1325
|
-
return throwError(() => new
|
|
1363
|
+
return throwError(() => new ClientError(`No 'previousPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1326
1364
|
}
|
|
1327
1365
|
return this.getQueryPage(link.href, multisite, options);
|
|
1328
1366
|
}
|
|
@@ -1332,7 +1370,7 @@ class VcdApiClient {
|
|
|
1332
1370
|
nextPage(result, multisite, options) {
|
|
1333
1371
|
const link = this.findLink(result, 'nextPage', result.type);
|
|
1334
1372
|
if (!link) {
|
|
1335
|
-
return throwError(() => new
|
|
1373
|
+
return throwError(() => new ClientError(`No 'nextPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1336
1374
|
}
|
|
1337
1375
|
return this.getQueryPage(link.href, multisite, options);
|
|
1338
1376
|
}
|
|
@@ -1342,7 +1380,7 @@ class VcdApiClient {
|
|
|
1342
1380
|
lastPage(result, multisite, options) {
|
|
1343
1381
|
const link = this.findLink(result, 'lastPage', result.type);
|
|
1344
1382
|
if (!link) {
|
|
1345
|
-
return throwError(() => new
|
|
1383
|
+
return throwError(() => new ClientError(`No 'lastPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1346
1384
|
}
|
|
1347
1385
|
return this.getQueryPage(link.href, multisite, options);
|
|
1348
1386
|
}
|
|
@@ -1509,5 +1547,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
1509
1547
|
* Generated bundle index. Do not edit.
|
|
1510
1548
|
*/
|
|
1511
1549
|
|
|
1512
|
-
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, WizardExtensionWithValidationComponent, _EntityActionExtensionComponent, _WizardExtensionComponent, _WizardExtensionWithValidationComponent, parseHeaderHateoasLinks };
|
|
1550
|
+
export { API_ROOT_URL$1 as API_ROOT_URL, ApiResult, ApiResultService, AuthTokenHolderService$1 as AuthTokenHolderService, ClientError, ClientErrorType, EXTENSION_ASSET_URL$1 as EXTENSION_ASSET_URL, EXTENSION_ROUTE$1 as EXTENSION_ROUTE, EntityActionExtensionComponent, ExtensionNavRegistrationAction, FLEX_APP_URL$1 as FLEX_APP_URL, Filter, HATEOAS_HEADER, LinkRelType, LoggingInterceptor, MAX_CHUNK_RETRY_COUNT, MAX_CHUNK_SIZE, PluginModule, Query, RequestHeadersInterceptor, ResponseNormalizationInterceptor, SDK_MODE$1 as SDK_MODE, SESSION_ORGANIZATION$1 as SESSION_ORGANIZATION, SESSION_ORG_ID$1 as SESSION_ORG_ID, SESSION_SCOPE$1 as SESSION_SCOPE, TRANSFER_LINK_REL, TransferError, VCD_HTTP_INTERCEPTORS, VcdApiClient, VcdHttpClient, VcdSdkConfig, VcdSdkModule, VcdTransferClient, WizardExtensionComponent, WizardExtensionWithContextComponent, WizardExtensionWithValidationComponent, _EntityActionExtensionComponent, _WizardExtensionComponent, _WizardExtensionWithContextComponent, _WizardExtensionWithValidationComponent, parseHeaderHateoasLinks };
|
|
1513
1551
|
//# sourceMappingURL=vcd-sdk.mjs.map
|