Angular Expanders 5.0.0
Changes and improvements
This major release marks the beginning of data access (control layer) separation in the angular stack. This has been accomplished by expanding DataAccess
interfaces and InjectionTokens
. This token can be implemented by a separate expansion resource specific to a certain control layer implementation, e.g. rest-expanders
, json:API
, ...
For the moment two data access implementation resources exist:
angular-svcapi-stack
(rest-expanders)angular-stdapi-stack
(jaxrs struts replacement)
Migration guide
Expansion Resources
In order to make different implementations of the data access possible, the implementation specific expanders needed to be split into new expansion resources. For convenience, this has been combined in a svcapi
and stdapi
stack resource. To trigger the correct expansion the Svc API
or Std API
profile has to be added to the AngularApp
expansion.
<expansionSettings>
<modelDirectory>..</modelDirectory>
<expansionDirectory>../expansions</expansionDirectory>
<expansions>
<expansion>
<type component="elements" name="JeeApplication"/>
<target>angularExpandersDemo::4.12.0-SNAPSHOT</target>
<variant>angularExpandersDemo</variant>
</expansion>
<expansion>
<type component="angularProjects" name="AngularApp"/>
<target>angular-expanders-demo</target>
</expansion>
</expansions>
<expansionResources>
<expansionResource name="net.democritus:sql-expanders" version="4.2.0"/>
<expansionResource name="net.democritus.angular:angular-jaxrs-stack" version="4.11.0"/>
</expansionResources>
<settingsDirectories>
<settingsDirectory>
<directory>../settings</directory>
</settingsDirectory>
</settingsDirectories>
</expansionSettings>
<expansionSettings>
<modelDirectory>..</modelDirectory>
<expansionDirectory>../expansions</expansionDirectory>
<expansions>
<expansion>
<type component="elements" name="JeeApplication"/>
<target>angularExpandersDemo::4.12.0-SNAPSHOT</target>
<variant>angularExpandersDemo</variant>
</expansion>
<expansion>
<type component="angularProjects" name="AngularApp"/>
<target>angular-expanders-demo</target>
<profile name="Svc API"/>
</expansion>
</expansions>
<expansionResources>
<expansionResource name="net.democritus:sql-expanders" version="4.2.0"/>
<expansionResource name="net.democritus:angular-svcapi-stack" version="1.0.0-SNAPSHOT"/>
</expansionResources>
<settingsDirectories>
<settingsDirectory>
<directory>../settings</directory>
</settingsDirectory>
</settingsDirectories>
</expansionSettings>
Data Access tokens
Before the <DataConnector>-data-access.service
was injected directly. Now you should inject the <DataConnector_DATA_ACCESS
token instead. This token gets a different implementation depending on the usage of std
or svc
API. The interface of data access has also slightly changed:
getSingle({ id }: { id: string }): Observable<DemoElementModel>;
getList(demoElementSegmentParameters: DemoElementSegmentParameters): Observable<DemoElementListModel>;
create(model: DemoElementModel): Observable<InstanceCreated>;
update(model: DemoElementModel): Observable<void>;
delete({ id }: { id: string }): Observable<void>;
getSingle({ id }: { id: string }): Observable<DemoElementModel>;
getList({ segmentParameters }: { segmentParameters?: DemoElementSegmentParameters }): Observable<DemoElementListModel>;
create({ model }: { model: DemoElementModel }): Observable<{ id: string }>;
update({ model }: { model: DemoElementModel }): Observable<void>;
delete({ id }: { id: string }): Observable<void>;
Http service
http.service
has been deleted, because the implementation of this service was control layer specific. Due to the separation of the control layer implementation this service has been removed. Functionality has been moved to either FILE_IO_DATA_ACCESS
of other helper services/functions with the same behaviour.
This service contained the method baseUrl()
. This method has been removed and every endpoint builds the complete url now.
get baseUrl() {
return `${__config.baseUrl}/myAppShortName`
}
Filters
Filter fields are now camelCase. Previous filter fields found in <DataConnector>-filters.ts
(and related services/components) were lowercase. This was a overfitting to the rest-expanders
, with the separation of the control layer this has been fixed. This will result in custom code that not will compile and potentially missing translations.
Events
Added <DataConnector>-event.model.ts
and <DataConnector>-event.service.ts
where DataAccess
events can be defined and subscribed to. This is now separated from the <DataConnector>-data-access.service
.
Pagination
Pagination was refactored a bit, because it was overfit to the rest-expanders
. To fix this PageModel.ts
and Pagination.ts
were deleted. These have been replaced by page.model.ts
from @nsx/ngx-ns-core
. The rest-expander
and standard
APIs alternative will map to this.