@smartbit4all/ng-client 3.3.216 → 3.3.218
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/esm2020/lib/session/api/api/session.service.mjs +1 -1
- package/esm2020/lib/session/api/encoder.mjs +1 -1
- package/esm2020/lib/session/api/model/accountInfo.mjs +1 -1
- package/esm2020/lib/session/api/model/apiError.mjs +1 -1
- package/esm2020/lib/session/api/model/authenticationProviderData.mjs +1 -1
- package/esm2020/lib/session/api/model/getAuthenticationProvidersResponse.mjs +1 -1
- package/esm2020/lib/session/api/model/models.mjs +1 -1
- package/esm2020/lib/session/api/model/refreshSessionRequest.mjs +1 -1
- package/esm2020/lib/session/api/model/session.mjs +1 -1
- package/esm2020/lib/session/api/model/userActivityLog.mjs +1 -1
- package/esm2020/lib/session/api/param.mjs +1 -1
- package/esm2020/lib/session/api/variables.mjs +1 -1
- package/esm2020/lib/session/smart-error-catching.interceptor.mjs +11 -2
- package/esm2020/lib/session/smart-session-handler.service.mjs +1 -1
- package/esm2020/lib/session/smart-session.service.mjs +31 -26
- package/esm2020/lib/smart-component-layout/api/api/api.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/api/default.service.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/api.module.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/configuration.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/encoder.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/index.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/componentType.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/componentWidgetType.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/layoutDirection.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/models.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/smartComponentLayoutDefinition.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/model/smartComponentWidgetDefinition.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/param.mjs +1 -1
- package/esm2020/lib/smart-component-layout/api/variables.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBoolOperator.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderField.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderGroup.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionBuilderModel.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionData.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionDataType.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionFieldList.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionFieldWidgetType.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionList.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOperandData.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOperation.mjs +1 -1
- package/esm2020/lib/smart-filter/api/filter/model/filterExpressionOrderBy.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/api/filter.service.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/configuration.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/encoder.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBoolOperator.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderApiConfig.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderField.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderGroup.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderModel.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderUiModel.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionData.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionDataType.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldEditor.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldList.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldWidgetType.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionList.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperandData.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperation.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/smartFilterType.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/param.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/variables.mjs +1 -1
- package/esm2020/lib/smart-form/api/api/api.mjs +1 -1
- package/esm2020/lib/smart-form/api/api/default.service.mjs +1 -1
- package/esm2020/lib/smart-form/api/api.module.mjs +1 -1
- package/esm2020/lib/smart-form/api/configuration.mjs +1 -1
- package/esm2020/lib/smart-form/api/encoder.mjs +1 -1
- package/esm2020/lib/smart-form/api/index.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/propertyMapping.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/selectionDefinition.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartFormWidgetDirection.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartFormWidgetType.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartLayoutDefinition.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartWidgetHint.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/valueChangeMode.mjs +1 -1
- package/esm2020/lib/smart-form/api/param.mjs +1 -1
- package/esm2020/lib/smart-form/api/variables.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/index.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnContentType.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnMeta.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionChange.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/param.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
- package/esm2020/lib/smart-table/tables/mobile-table/mobile-table.component.mjs +3 -3
- package/esm2020/lib/smart-tree/tree-api/api/tree.service.mjs +1 -1
- package/esm2020/lib/smart-tree/tree-api/configuration.mjs +1 -1
- package/esm2020/lib/smart-tree/tree-api/encoder.mjs +1 -1
- package/esm2020/lib/smart-tree/tree-api/param.mjs +1 -1
- package/esm2020/lib/smart-tree/tree-api/variables.mjs +1 -1
- package/esm2020/lib/view-context/api/api/api.mjs +1 -1
- package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
- package/esm2020/lib/view-context/api/api.module.mjs +1 -1
- package/esm2020/lib/view-context/api/configuration.mjs +1 -1
- package/esm2020/lib/view-context/api/encoder.mjs +1 -1
- package/esm2020/lib/view-context/api/index.mjs +1 -1
- package/esm2020/lib/view-context/api/model/closeResult.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentModel.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentModelChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChangeEvent.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChangeKind.mjs +1 -1
- package/esm2020/lib/view-context/api/model/downloadedFile.mjs +1 -1
- package/esm2020/lib/view-context/api/model/iconPosition.mjs +1 -1
- package/esm2020/lib/view-context/api/model/imageResource.mjs +1 -1
- package/esm2020/lib/view-context/api/model/link.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageOption.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageOptionType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageResult.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageTextType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/openPendingData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/serverRequestExecutionStat.mjs +1 -1
- package/esm2020/lib/view-context/api/model/serverRequestTrack.mjs +1 -1
- package/esm2020/lib/view-context/api/model/serverRequestType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/smartLinkData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/statisticRecord.mjs +1 -1
- package/esm2020/lib/view-context/api/model/style.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiAction.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionButtonType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionDialogDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionFeedbackType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionInputType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionRequest.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionTooltip.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionUploadDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/valueSet.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewApiError.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewContextChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewState.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewStateUpdate.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewType.mjs +1 -1
- package/esm2020/lib/view-context/api/param.mjs +1 -1
- package/esm2020/lib/view-context/api/variables.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api/api.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api/value.service.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api.module.mjs +1 -1
- package/esm2020/lib/view-context/value-api/configuration.mjs +1 -1
- package/esm2020/lib/view-context/value-api/encoder.mjs +1 -1
- package/esm2020/lib/view-context/value-api/index.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/genericValue.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/models.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/value.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinition.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinitionIdentifier.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetOperand.mjs +1 -1
- package/esm2020/lib/view-context/value-api/param.mjs +1 -1
- package/esm2020/lib/view-context/value-api/variables.mjs +1 -1
- package/fesm2015/smartbit4all-ng-client.mjs +42 -29
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +42 -29
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/session/smart-session-handler.service.d.ts +10 -0
- package/lib/session/smart-session.service.d.ts +2 -0
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.3.218.tgz +0 -0
- package/src/lib/session/api/README.md +226 -226
- package/src/lib/smart-component-layout/api/README.md +226 -226
- package/src/lib/smart-filter-editor/api/README.md +226 -226
- package/src/lib/smart-form/api/README.md +226 -226
- package/src/lib/smart-grid/api/grid-api/README.md +226 -226
- package/src/lib/smart-tree/tree-api/README.md +226 -226
- package/src/lib/view-context/api/README.md +226 -226
- package/src/lib/view-context/value-api/README.md +226 -226
- package/smartbit4all-ng-client-3.3.216.tgz +0 -0
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export interface SmartSessionHandlerService {
|
|
2
|
+
/**
|
|
3
|
+
* Handles SessionErrors with RESTART behaviour. With this method it is possible to add application
|
|
4
|
+
* specific logic to the session restart mechanism.
|
|
5
|
+
* E.g.: navigate to the login page when the session can not be refreshed.
|
|
6
|
+
*
|
|
7
|
+
* By default when the session can not be refreshed, the smart-session.service clears and starts a new session.
|
|
8
|
+
* By throwing an exception in this method it is possible to avoid this default functionality,
|
|
9
|
+
* and handle the session recreation completely here in the application level.
|
|
10
|
+
* @param sessionError the SessionError with RESTART behaviour cached in the http interceptor
|
|
11
|
+
*/
|
|
2
12
|
handleSessionError(sessionError: SessionError): Promise<void>;
|
|
3
13
|
}
|
|
4
14
|
export interface SessionError {
|
|
@@ -44,6 +44,8 @@ export declare class SmartSessionService implements OnDestroy {
|
|
|
44
44
|
private startSession;
|
|
45
45
|
getSession(): Promise<SessionInfoData>;
|
|
46
46
|
refreshSession(): Promise<SessionInfoData>;
|
|
47
|
+
private updateSessionInfo;
|
|
48
|
+
private isInvalidRefreshTokenError;
|
|
47
49
|
getAuthenticationProviders(): Promise<Array<AuthenticationProviderData>>;
|
|
48
50
|
getIsAuthenticated(): Promise<boolean>;
|
|
49
51
|
clearAndStartNewSession(): Promise<void>;
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
## @
|
|
2
|
-
|
|
3
|
-
### Building
|
|
4
|
-
|
|
5
|
-
To install the required dependencies and to build the typescript sources run:
|
|
6
|
-
```
|
|
7
|
-
npm install
|
|
8
|
-
npm run build
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### publishing
|
|
12
|
-
|
|
13
|
-
First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
|
|
14
|
-
|
|
15
|
-
### consuming
|
|
16
|
-
|
|
17
|
-
Navigate to the folder of your consuming project and run one of next commands.
|
|
18
|
-
|
|
19
|
-
_published:_
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
npm install @ --save
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
_without publishing (not recommended):_
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
|
32
|
-
|
|
33
|
-
_using `npm link`:_
|
|
34
|
-
|
|
35
|
-
In PATH_TO_GENERATED_PACKAGE/dist:
|
|
36
|
-
```
|
|
37
|
-
npm link
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
In your project:
|
|
41
|
-
```
|
|
42
|
-
npm link
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
|
46
|
-
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
|
47
|
-
Published packages are not effected by this issue.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
#### General usage
|
|
51
|
-
|
|
52
|
-
In your Angular project:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
// without configuring providers
|
|
57
|
-
import { ApiModule } from '';
|
|
58
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
59
|
-
|
|
60
|
-
@NgModule({
|
|
61
|
-
imports: [
|
|
62
|
-
ApiModule,
|
|
63
|
-
// make sure to import the HttpClientModule in the AppModule only,
|
|
64
|
-
// see https://github.com/angular/angular/issues/20575
|
|
65
|
-
HttpClientModule
|
|
66
|
-
],
|
|
67
|
-
declarations: [ AppComponent ],
|
|
68
|
-
providers: [],
|
|
69
|
-
bootstrap: [ AppComponent ]
|
|
70
|
-
})
|
|
71
|
-
export class AppModule {}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
// configuring providers
|
|
76
|
-
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
|
77
|
-
|
|
78
|
-
export function apiConfigFactory (): Configuration {
|
|
79
|
-
const params: ConfigurationParameters = {
|
|
80
|
-
// set configuration parameters here.
|
|
81
|
-
}
|
|
82
|
-
return new Configuration(params);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@NgModule({
|
|
86
|
-
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
|
87
|
-
declarations: [ AppComponent ],
|
|
88
|
-
providers: [],
|
|
89
|
-
bootstrap: [ AppComponent ]
|
|
90
|
-
})
|
|
91
|
-
export class AppModule {}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
// configuring providers with an authentication service that manages your access tokens
|
|
96
|
-
import { ApiModule, Configuration } from '';
|
|
97
|
-
|
|
98
|
-
@NgModule({
|
|
99
|
-
imports: [ ApiModule ],
|
|
100
|
-
declarations: [ AppComponent ],
|
|
101
|
-
providers: [
|
|
102
|
-
{
|
|
103
|
-
provide: Configuration,
|
|
104
|
-
useFactory: (authService: AuthService) => new Configuration(
|
|
105
|
-
{
|
|
106
|
-
basePath: environment.apiUrl,
|
|
107
|
-
accessToken: authService.getAccessToken.bind(authService)
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
deps: [AuthService],
|
|
111
|
-
multi: false
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
bootstrap: [ AppComponent ]
|
|
115
|
-
})
|
|
116
|
-
export class AppModule {}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
import { DefaultApi } from '';
|
|
121
|
-
|
|
122
|
-
export class AppComponent {
|
|
123
|
-
constructor(private apiGateway: DefaultApi) { }
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Note: The ApiModule is restricted to being instantiated once app wide.
|
|
128
|
-
This is to ensure that all services are treated as singletons.
|
|
129
|
-
|
|
130
|
-
#### Using multiple OpenAPI files / APIs / ApiModules
|
|
131
|
-
In order to use multiple `ApiModules` generated from different OpenAPI files,
|
|
132
|
-
you can create an alias name when importing the modules
|
|
133
|
-
in order to avoid naming conflicts:
|
|
134
|
-
```
|
|
135
|
-
import { ApiModule } from 'my-api-path';
|
|
136
|
-
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
|
137
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
138
|
-
|
|
139
|
-
@NgModule({
|
|
140
|
-
imports: [
|
|
141
|
-
ApiModule,
|
|
142
|
-
OtherApiModule,
|
|
143
|
-
// make sure to import the HttpClientModule in the AppModule only,
|
|
144
|
-
// see https://github.com/angular/angular/issues/20575
|
|
145
|
-
HttpClientModule
|
|
146
|
-
]
|
|
147
|
-
})
|
|
148
|
-
export class AppModule {
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
### Set service base path
|
|
155
|
-
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
import { BASE_PATH } from '';
|
|
159
|
-
|
|
160
|
-
bootstrap(AppComponent, [
|
|
161
|
-
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
|
162
|
-
]);
|
|
163
|
-
```
|
|
164
|
-
or
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
import { BASE_PATH } from '';
|
|
168
|
-
|
|
169
|
-
@NgModule({
|
|
170
|
-
imports: [],
|
|
171
|
-
declarations: [ AppComponent ],
|
|
172
|
-
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
|
173
|
-
bootstrap: [ AppComponent ]
|
|
174
|
-
})
|
|
175
|
-
export class AppModule {}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
#### Using @angular/cli
|
|
180
|
-
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
export const environment = {
|
|
184
|
-
production: false,
|
|
185
|
-
API_BASE_PATH: 'http://127.0.0.1:8080'
|
|
186
|
-
};
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
In the src/app/app.module.ts:
|
|
190
|
-
```
|
|
191
|
-
import { BASE_PATH } from '';
|
|
192
|
-
import { environment } from '../environments/environment';
|
|
193
|
-
|
|
194
|
-
@NgModule({
|
|
195
|
-
declarations: [
|
|
196
|
-
AppComponent
|
|
197
|
-
],
|
|
198
|
-
imports: [ ],
|
|
199
|
-
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
|
200
|
-
bootstrap: [ AppComponent ]
|
|
201
|
-
})
|
|
202
|
-
export class AppModule { }
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Customizing path parameter encoding
|
|
206
|
-
|
|
207
|
-
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
|
208
|
-
and Dates for format 'date-time' are encoded correctly.
|
|
209
|
-
|
|
210
|
-
Other styles (e.g. "matrix") are not that easy to encode
|
|
211
|
-
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
|
212
|
-
|
|
213
|
-
To implement your own parameter encoding (or call another library),
|
|
214
|
-
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
|
215
|
-
(see [General Usage](#general-usage) above).
|
|
216
|
-
|
|
217
|
-
Example value for use in your Configuration-Provider:
|
|
218
|
-
```typescript
|
|
219
|
-
new Configuration({
|
|
220
|
-
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
|
221
|
-
})
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
|
225
|
-
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
|
226
|
-
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|
|
1
|
+
## @
|
|
2
|
+
|
|
3
|
+
### Building
|
|
4
|
+
|
|
5
|
+
To install the required dependencies and to build the typescript sources run:
|
|
6
|
+
```
|
|
7
|
+
npm install
|
|
8
|
+
npm run build
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### publishing
|
|
12
|
+
|
|
13
|
+
First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
|
|
14
|
+
|
|
15
|
+
### consuming
|
|
16
|
+
|
|
17
|
+
Navigate to the folder of your consuming project and run one of next commands.
|
|
18
|
+
|
|
19
|
+
_published:_
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm install @ --save
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
_without publishing (not recommended):_
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
|
32
|
+
|
|
33
|
+
_using `npm link`:_
|
|
34
|
+
|
|
35
|
+
In PATH_TO_GENERATED_PACKAGE/dist:
|
|
36
|
+
```
|
|
37
|
+
npm link
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
In your project:
|
|
41
|
+
```
|
|
42
|
+
npm link
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
|
46
|
+
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
|
47
|
+
Published packages are not effected by this issue.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#### General usage
|
|
51
|
+
|
|
52
|
+
In your Angular project:
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
// without configuring providers
|
|
57
|
+
import { ApiModule } from '';
|
|
58
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
59
|
+
|
|
60
|
+
@NgModule({
|
|
61
|
+
imports: [
|
|
62
|
+
ApiModule,
|
|
63
|
+
// make sure to import the HttpClientModule in the AppModule only,
|
|
64
|
+
// see https://github.com/angular/angular/issues/20575
|
|
65
|
+
HttpClientModule
|
|
66
|
+
],
|
|
67
|
+
declarations: [ AppComponent ],
|
|
68
|
+
providers: [],
|
|
69
|
+
bootstrap: [ AppComponent ]
|
|
70
|
+
})
|
|
71
|
+
export class AppModule {}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
// configuring providers
|
|
76
|
+
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
|
77
|
+
|
|
78
|
+
export function apiConfigFactory (): Configuration {
|
|
79
|
+
const params: ConfigurationParameters = {
|
|
80
|
+
// set configuration parameters here.
|
|
81
|
+
}
|
|
82
|
+
return new Configuration(params);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@NgModule({
|
|
86
|
+
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
|
87
|
+
declarations: [ AppComponent ],
|
|
88
|
+
providers: [],
|
|
89
|
+
bootstrap: [ AppComponent ]
|
|
90
|
+
})
|
|
91
|
+
export class AppModule {}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
// configuring providers with an authentication service that manages your access tokens
|
|
96
|
+
import { ApiModule, Configuration } from '';
|
|
97
|
+
|
|
98
|
+
@NgModule({
|
|
99
|
+
imports: [ ApiModule ],
|
|
100
|
+
declarations: [ AppComponent ],
|
|
101
|
+
providers: [
|
|
102
|
+
{
|
|
103
|
+
provide: Configuration,
|
|
104
|
+
useFactory: (authService: AuthService) => new Configuration(
|
|
105
|
+
{
|
|
106
|
+
basePath: environment.apiUrl,
|
|
107
|
+
accessToken: authService.getAccessToken.bind(authService)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
deps: [AuthService],
|
|
111
|
+
multi: false
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
bootstrap: [ AppComponent ]
|
|
115
|
+
})
|
|
116
|
+
export class AppModule {}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
import { DefaultApi } from '';
|
|
121
|
+
|
|
122
|
+
export class AppComponent {
|
|
123
|
+
constructor(private apiGateway: DefaultApi) { }
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Note: The ApiModule is restricted to being instantiated once app wide.
|
|
128
|
+
This is to ensure that all services are treated as singletons.
|
|
129
|
+
|
|
130
|
+
#### Using multiple OpenAPI files / APIs / ApiModules
|
|
131
|
+
In order to use multiple `ApiModules` generated from different OpenAPI files,
|
|
132
|
+
you can create an alias name when importing the modules
|
|
133
|
+
in order to avoid naming conflicts:
|
|
134
|
+
```
|
|
135
|
+
import { ApiModule } from 'my-api-path';
|
|
136
|
+
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
|
137
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
138
|
+
|
|
139
|
+
@NgModule({
|
|
140
|
+
imports: [
|
|
141
|
+
ApiModule,
|
|
142
|
+
OtherApiModule,
|
|
143
|
+
// make sure to import the HttpClientModule in the AppModule only,
|
|
144
|
+
// see https://github.com/angular/angular/issues/20575
|
|
145
|
+
HttpClientModule
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
export class AppModule {
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Set service base path
|
|
155
|
+
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
import { BASE_PATH } from '';
|
|
159
|
+
|
|
160
|
+
bootstrap(AppComponent, [
|
|
161
|
+
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
|
162
|
+
]);
|
|
163
|
+
```
|
|
164
|
+
or
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
import { BASE_PATH } from '';
|
|
168
|
+
|
|
169
|
+
@NgModule({
|
|
170
|
+
imports: [],
|
|
171
|
+
declarations: [ AppComponent ],
|
|
172
|
+
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
|
173
|
+
bootstrap: [ AppComponent ]
|
|
174
|
+
})
|
|
175
|
+
export class AppModule {}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
#### Using @angular/cli
|
|
180
|
+
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
export const environment = {
|
|
184
|
+
production: false,
|
|
185
|
+
API_BASE_PATH: 'http://127.0.0.1:8080'
|
|
186
|
+
};
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
In the src/app/app.module.ts:
|
|
190
|
+
```
|
|
191
|
+
import { BASE_PATH } from '';
|
|
192
|
+
import { environment } from '../environments/environment';
|
|
193
|
+
|
|
194
|
+
@NgModule({
|
|
195
|
+
declarations: [
|
|
196
|
+
AppComponent
|
|
197
|
+
],
|
|
198
|
+
imports: [ ],
|
|
199
|
+
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
|
200
|
+
bootstrap: [ AppComponent ]
|
|
201
|
+
})
|
|
202
|
+
export class AppModule { }
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Customizing path parameter encoding
|
|
206
|
+
|
|
207
|
+
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
|
208
|
+
and Dates for format 'date-time' are encoded correctly.
|
|
209
|
+
|
|
210
|
+
Other styles (e.g. "matrix") are not that easy to encode
|
|
211
|
+
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
|
212
|
+
|
|
213
|
+
To implement your own parameter encoding (or call another library),
|
|
214
|
+
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
|
215
|
+
(see [General Usage](#general-usage) above).
|
|
216
|
+
|
|
217
|
+
Example value for use in your Configuration-Provider:
|
|
218
|
+
```typescript
|
|
219
|
+
new Configuration({
|
|
220
|
+
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
|
225
|
+
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
|
226
|
+
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|