@vcd/sdk 15.0.4 → 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/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/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/core/plugin.module.mjs +6 -1
- package/esm2020/main.mjs +2 -2
- package/fesm2015/vcd-sdk.mjs +158 -131
- package/fesm2015/vcd-sdk.mjs.map +1 -1
- package/fesm2020/vcd-sdk.mjs +156 -131
- package/fesm2020/vcd-sdk.mjs.map +1 -1
- package/main.d.ts +1 -1
- package/package.json +1 -1
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$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) {
|
|
@@ -536,27 +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 }
|
|
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
|
+
}] }]; } });
|
|
560
673
|
|
|
561
674
|
/**
|
|
562
675
|
* This is the currently supported - albeit very minimal - public SDK.
|
|
@@ -565,37 +678,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
565
678
|
if (!window.System || !window.System.registry || !window.System.registry.get) {
|
|
566
679
|
throw new Error('SystemJS registry not found');
|
|
567
680
|
}
|
|
568
|
-
let containerHooks
|
|
569
|
-
if (!containerHooks
|
|
570
|
-
containerHooks
|
|
681
|
+
let containerHooks = window.System.registry.get('@vcd/common');
|
|
682
|
+
if (!containerHooks) {
|
|
683
|
+
containerHooks = window.System.registry.get('@vcd-ui/common');
|
|
571
684
|
}
|
|
572
|
-
if (!containerHooks
|
|
685
|
+
if (!containerHooks) {
|
|
573
686
|
throw new Error('VCD UI container hooks not present in SystemJS registry');
|
|
574
687
|
}
|
|
575
688
|
/**
|
|
576
689
|
* Wire in as a string. Gives the root URL for API access (for example, the load balancer URL
|
|
577
690
|
* or the single-cell URL).
|
|
578
691
|
*/
|
|
579
|
-
const API_ROOT_URL
|
|
692
|
+
const API_ROOT_URL = containerHooks.API_ROOT_URL;
|
|
580
693
|
/**
|
|
581
694
|
* Wire in as a string. Gives the root URL for the legacy Flex application.
|
|
582
695
|
*/
|
|
583
|
-
const FLEX_APP_URL
|
|
696
|
+
const FLEX_APP_URL = containerHooks.API_ROOT_URL;
|
|
584
697
|
/**
|
|
585
698
|
* Wire in as a string. Gives the current scope of the VCD-UI. As of current, this will be
|
|
586
699
|
* either 'tenant' for the tenant portal, or 'service-provider' for the service-provider portal.
|
|
587
700
|
*/
|
|
588
|
-
const SESSION_SCOPE
|
|
701
|
+
const SESSION_SCOPE = containerHooks.SESSION_SCOPE;
|
|
589
702
|
/**
|
|
590
703
|
* Wire in as a string. Gives the unique name (not the display name) of the current tenant
|
|
591
704
|
* organization that the VCD-UI is being used for.
|
|
592
705
|
*/
|
|
593
|
-
const SESSION_ORGANIZATION
|
|
706
|
+
const SESSION_ORGANIZATION = containerHooks.SESSION_ORGANIZATION;
|
|
594
707
|
/**
|
|
595
708
|
* Wire in as a string. Gives the UUID identifier of the current tenant
|
|
596
709
|
* organization that the VCD-UI is being used for.
|
|
597
710
|
*/
|
|
598
|
-
const SESSION_ORG_ID
|
|
711
|
+
const SESSION_ORG_ID = containerHooks.SESSION_ORG_ID ? containerHooks.SESSION_ORG_ID : '';
|
|
599
712
|
/**
|
|
600
713
|
* Wire in as a string. Gives the full root path for module assets (e.g. images, scripts, text files)
|
|
601
714
|
*
|
|
@@ -603,16 +716,16 @@ const SESSION_ORG_ID$1 = containerHooks$1.SESSION_ORG_ID ? containerHooks$1.SESS
|
|
|
603
716
|
* Add || new InjectionToken to workaround the Angular security mechanics which prevent use of injection tokens
|
|
604
717
|
* which potentially are not defiend. The same fix can be applied for the rest tokens if needed.
|
|
605
718
|
*/
|
|
606
|
-
const EXTENSION_ASSET_URL
|
|
719
|
+
const EXTENSION_ASSET_URL = containerHooks.EXTENSION_ASSET_URL || new InjectionToken('EXTENSION_ASSET_URL');
|
|
607
720
|
/**
|
|
608
721
|
* Wire in as a string. Gives the Angular 2 route that the module is registered under.
|
|
609
722
|
*/
|
|
610
|
-
const EXTENSION_ROUTE
|
|
723
|
+
const EXTENSION_ROUTE = containerHooks.EXTENSION_ROUTE;
|
|
611
724
|
/**
|
|
612
725
|
* Wire in as a boolean. True if running under the SDK, false if running in production.
|
|
613
726
|
*/
|
|
614
|
-
const SDK_MODE
|
|
615
|
-
const AuthTokenHolderService
|
|
727
|
+
const SDK_MODE = containerHooks.SDK_MODE;
|
|
728
|
+
const AuthTokenHolderService = containerHooks.AuthTokenHolderService;
|
|
616
729
|
|
|
617
730
|
/**
|
|
618
731
|
* Default chunk size is 50MiB. This is equal to the chunk size the VCD UI uses for library uploads.
|
|
@@ -777,106 +890,18 @@ class VcdTransferClient {
|
|
|
777
890
|
}
|
|
778
891
|
}
|
|
779
892
|
|
|
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));
|
|
893
|
+
class ClientError extends Error {
|
|
894
|
+
constructor(message, type) {
|
|
895
|
+
super(message);
|
|
896
|
+
this.message = message;
|
|
897
|
+
this.type = type;
|
|
870
898
|
}
|
|
871
899
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
*/
|
|
878
|
-
class VcdSdkConfig {
|
|
879
|
-
}
|
|
900
|
+
var ClientErrorType;
|
|
901
|
+
(function (ClientErrorType) {
|
|
902
|
+
ClientErrorType["HateoasLinkMissing"] = "HateoasLinkMissing";
|
|
903
|
+
ClientErrorType["TaskLinkMissing"] = "TaskLinkMissing";
|
|
904
|
+
})(ClientErrorType || (ClientErrorType = {}));
|
|
880
905
|
|
|
881
906
|
const TRANSFER_LINK_REL = 'upload:default';
|
|
882
907
|
const HATEOAS_HEADER = 'Link';
|
|
@@ -995,7 +1020,7 @@ class VcdApiClient {
|
|
|
995
1020
|
* In this case the old API (/api/session) should not be used at all.
|
|
996
1021
|
*/
|
|
997
1022
|
this._isCloudApiLogin = false;
|
|
998
|
-
this._baseUrl = this.injector.get(API_ROOT_URL
|
|
1023
|
+
this._baseUrl = this.injector.get(API_ROOT_URL);
|
|
999
1024
|
let negotiatedVersion;
|
|
1000
1025
|
if (this.config?.apiVersion) {
|
|
1001
1026
|
negotiatedVersion = of(this.config.apiVersion).pipe(map((version) => {
|
|
@@ -1007,7 +1032,7 @@ class VcdApiClient {
|
|
|
1007
1032
|
negotiatedVersion = this.http.get(`${this._baseUrl}/api/versions`).pipe(map(versions => this.negotiateVersion(versions)), tap(version => this.setVersion(version)));
|
|
1008
1033
|
}
|
|
1009
1034
|
this._negotiateVersion = negotiatedVersion.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
1010
|
-
const tokenHolder = this.injector.get(AuthTokenHolderService
|
|
1035
|
+
const tokenHolder = this.injector.get(AuthTokenHolderService, { token: '' });
|
|
1011
1036
|
const token = tokenHolder.jwt ? `Bearer ${tokenHolder.jwt}` : tokenHolder.token;
|
|
1012
1037
|
this._getSession = this.setAuthentication(token)
|
|
1013
1038
|
.pipe(share({ connector: () => new ReplaySubject(1), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }));
|
|
@@ -1087,10 +1112,10 @@ class VcdApiClient {
|
|
|
1087
1112
|
this.http.requestHeadersInterceptor.authentication = authentication;
|
|
1088
1113
|
return this.http.get(`${this._baseUrl}/api/session`).pipe(tap(session => {
|
|
1089
1114
|
// automatically set actAs for provider in tenant scope
|
|
1090
|
-
if (session.org === 'System' && this.injector.get(SESSION_SCOPE
|
|
1115
|
+
if (session.org === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1091
1116
|
// Automatic actAs only works in versions >=9.5
|
|
1092
1117
|
try {
|
|
1093
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1118
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1094
1119
|
}
|
|
1095
1120
|
catch (e) {
|
|
1096
1121
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1199,10 +1224,10 @@ class VcdApiClient {
|
|
|
1199
1224
|
// Clear previous actAs
|
|
1200
1225
|
this.actAs(null);
|
|
1201
1226
|
// automatically set actAs for provider in tenant scope
|
|
1202
|
-
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE
|
|
1227
|
+
if (session.org && session.org.name === 'System' && this.injector.get(SESSION_SCOPE) === 'tenant') {
|
|
1203
1228
|
// Automatic actAs only works in versions >=9.5
|
|
1204
1229
|
try {
|
|
1205
|
-
this.actAs({ id: this.injector.get(SESSION_ORG_ID
|
|
1230
|
+
this.actAs({ id: this.injector.get(SESSION_ORG_ID) });
|
|
1206
1231
|
}
|
|
1207
1232
|
catch (e) {
|
|
1208
1233
|
console.warn('No SESSION_ORG_ID set in container. Automatic actAs is disabled.');
|
|
@@ -1264,7 +1289,7 @@ class VcdApiClient {
|
|
|
1264
1289
|
const link = [...headerLinks, ...links]
|
|
1265
1290
|
.find((l) => l.rel === transferRel);
|
|
1266
1291
|
if (!link) {
|
|
1267
|
-
throw new
|
|
1292
|
+
throw new ClientError(`Response from ${endpoint} did not contain a transfer link`, ClientErrorType.HateoasLinkMissing);
|
|
1268
1293
|
}
|
|
1269
1294
|
return link.href;
|
|
1270
1295
|
}));
|
|
@@ -1293,7 +1318,7 @@ class VcdApiClient {
|
|
|
1293
1318
|
const task = Object.assign(new TaskType(), response.body);
|
|
1294
1319
|
return of(task);
|
|
1295
1320
|
}
|
|
1296
|
-
return throwError(() => new
|
|
1321
|
+
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
1322
|
}
|
|
1298
1323
|
getEntity(entityRefOrUrn) {
|
|
1299
1324
|
const entityResolver = typeof entityRefOrUrn === 'string' ?
|
|
@@ -1310,7 +1335,7 @@ class VcdApiClient {
|
|
|
1310
1335
|
removeItem(item, options) {
|
|
1311
1336
|
const link = this.findLink(item, 'remove', null);
|
|
1312
1337
|
if (!link) {
|
|
1313
|
-
return throwError(() => new
|
|
1338
|
+
return throwError(() => new ClientError(`No 'remove' link for specified resource.`, ClientErrorType.HateoasLinkMissing));
|
|
1314
1339
|
}
|
|
1315
1340
|
return this.validateRequestContext().pipe(concatMap(() => this.http.delete(link.href, { ...options })));
|
|
1316
1341
|
}
|
|
@@ -1320,7 +1345,7 @@ class VcdApiClient {
|
|
|
1320
1345
|
firstPage(result, multisite, options) {
|
|
1321
1346
|
const link = this.findLink(result, 'firstPage', result.type);
|
|
1322
1347
|
if (!link) {
|
|
1323
|
-
return throwError(() => new
|
|
1348
|
+
return throwError(() => new ClientError(`No 'firstPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1324
1349
|
}
|
|
1325
1350
|
return this.getQueryPage(link.href, multisite, options);
|
|
1326
1351
|
}
|
|
@@ -1330,7 +1355,7 @@ class VcdApiClient {
|
|
|
1330
1355
|
previousPage(result, multisite, options) {
|
|
1331
1356
|
const link = this.findLink(result, 'previousPage', result.type);
|
|
1332
1357
|
if (!link) {
|
|
1333
|
-
return throwError(() => new
|
|
1358
|
+
return throwError(() => new ClientError(`No 'previousPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1334
1359
|
}
|
|
1335
1360
|
return this.getQueryPage(link.href, multisite, options);
|
|
1336
1361
|
}
|
|
@@ -1340,7 +1365,7 @@ class VcdApiClient {
|
|
|
1340
1365
|
nextPage(result, multisite, options) {
|
|
1341
1366
|
const link = this.findLink(result, 'nextPage', result.type);
|
|
1342
1367
|
if (!link) {
|
|
1343
|
-
return throwError(() => new
|
|
1368
|
+
return throwError(() => new ClientError(`No 'nextPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1344
1369
|
}
|
|
1345
1370
|
return this.getQueryPage(link.href, multisite, options);
|
|
1346
1371
|
}
|
|
@@ -1350,7 +1375,7 @@ class VcdApiClient {
|
|
|
1350
1375
|
lastPage(result, multisite, options) {
|
|
1351
1376
|
const link = this.findLink(result, 'lastPage', result.type);
|
|
1352
1377
|
if (!link) {
|
|
1353
|
-
return throwError(() => new
|
|
1378
|
+
return throwError(() => new ClientError(`No 'lastPage' link for specified query.`, ClientErrorType.HateoasLinkMissing));
|
|
1354
1379
|
}
|
|
1355
1380
|
return this.getQueryPage(link.href, multisite, options);
|
|
1356
1381
|
}
|
|
@@ -1515,5 +1540,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
1515
1540
|
* Generated bundle index. Do not edit.
|
|
1516
1541
|
*/
|
|
1517
1542
|
|
|
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 };
|
|
1543
|
+
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 };
|
|
1519
1544
|
//# sourceMappingURL=vcd-sdk.mjs.map
|