Skip to content

Commit 79e8805

Browse files
Made connect methods private
1 parent be10ae0 commit 79e8805

File tree

8 files changed

+24
-14
lines changed

8 files changed

+24
-14
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@ The repository provides the library itself, a playground app and a dummy backend
88

99
To run the playground app clone the repository and run an ```npm install``. Then start the backend with ``npm run server`` and the playground app with ``npm start``.
1010

11-
## Sample Application
11+
## Playground applicaiton
12+
13+
Use and review the playground application inside the repository to understand how to use the library. Also you can review the http responses and requests in the browser network tab to get an impression of how hypermedia json can look like.
14+
15+
## Documentation
16+
Will be done soon - I promise!
17+
18+
## Real World Sample Application
1219
There is a sample application [Fancy.ResourceLinker.Sample](https://github.com/fancyDevelopment/Fancy.ResourceLinker.Sample) which demonstrates end to end real world usage of hypermedia in Angular and also some other aspects of a real wold system.

angular.json

+3
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,8 @@
117117
}
118118
}
119119
}
120+
},
121+
"cli": {
122+
"analytics": false
120123
}
121124
}

apps/playground/src/app/app.state.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const AppState = signalStore(
77
withLinkedHypermediaResource('userInfo', { name: '', preferred_username: '' }),
88
withHooks({
99
onInit(store) {
10-
store.connectUserInfo(store.rootApi, 'userinfo')
10+
store._connectUserInfo(store.rootApi, 'userinfo')
1111
}
1212
})
1313
);

apps/playground/src/app/core/core.state.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const CoreState = signalStore(
99
withLinkedHypermediaResource('homeVm', initialHomeVm),
1010
withHooks({
1111
onInit(store) {
12-
store.connectHomeVm(inject(AppState).rootApi, 'homeVm')
12+
store._connectHomeVm(inject(AppState).rootApi, 'homeVm')
1313
}
1414
})
1515
);

apps/playground/src/app/flight/flight.state.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export const FlightState = signalStore(
1414
withHypermediaAction('createFlight'),
1515
withHooks({
1616
onInit(store) {
17-
store.connectUpdateFlightConnection(store.flightEditVm.flight.connection, 'update');
18-
store.connectUpdateFlightTimes(store.flightEditVm.flight.times, 'update');
19-
store.connectUpdateFlightOperator(store.flightEditVm.flight.operator, 'update');
20-
store.connectUpdateFlightPrice(store.flightEditVm.flight.price, 'update');
21-
store.connectFlightCreateVm(store.flightSearchVm, 'flightCreateVm');
22-
store.connectCreateFlight(store.flightCreateVm.template, 'create');
17+
store._connectUpdateFlightConnection(store.flightEditVm.flight.connection, 'update');
18+
store._connectUpdateFlightTimes(store.flightEditVm.flight.times, 'update');
19+
store._connectUpdateFlightOperator(store.flightEditVm.flight.operator, 'update');
20+
store._connectUpdateFlightPrice(store.flightEditVm.flight.price, 'update');
21+
store._connectFlightCreateVm(store.flightSearchVm, 'flightCreateVm');
22+
store._connectCreateFlight(store.flightCreateVm.template, 'create');
2323
}
2424
})
2525
);

libs/ngrx-hateoas/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-architects/ngrx-hateoas",
3-
"version": "18.0.0-rc.3",
3+
"version": "18.0.0-rc.4",
44
"peerDependencies": {
55
"@angular/common": "^18.0.0",
66
"@angular/core": "^18.0.0",

libs/ngrx-hateoas/src/lib/store-features/with-hypermedia-action.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export function generateExecuteHypermediaActionMethodName(actionName: string) {
3232
}
3333

3434
export type ConnectHypermediaActionMethod<ActionName extends string> = {
35-
[K in ActionName as `connect${Capitalize<ActionName>}`]: (linkRoot: Signal<unknown>, action: string) => void
35+
[K in ActionName as `_connect${Capitalize<ActionName>}`]: (linkRoot: Signal<unknown>, action: string) => void
3636
};
3737

3838
export function generateConnectHypermediaActionMethodName(actionName: string) {
39-
return `connect${actionName.charAt(0).toUpperCase() + actionName.slice(1)}`;
39+
return `_connect${actionName.charAt(0).toUpperCase() + actionName.slice(1)}`;
4040
}
4141

4242
export type HypermediaActionMethods<ActionName extends string> =

libs/ngrx-hateoas/src/lib/store-features/with-linked-hypermedia-resource.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export type LinkedHypermediaResourceStoreState<ResourceName extends string, TRes
2727
& LinkedHypermediaResourceState<ResourceName>;
2828

2929
export type ConnectLinkedHypermediaResourceMethod<ResourceName extends string> = {
30-
[K in ResourceName as `connect${Capitalize<ResourceName>}`]: (linkRoot: Signal<unknown>, linkName: string) => void
30+
[K in ResourceName as `_connect${Capitalize<ResourceName>}`]: (linkRoot: Signal<unknown>, linkName: string) => void
3131
};
3232

3333
export function generateConnectLinkedHypermediaResourceMethodName(resourceName: string) {
34-
return `connect${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)}`;
34+
return `_connect${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)}`;
3535
}
3636

3737
export type ReloadLinkedHypermediaResourceMethod<ResourceName extends string> = {

0 commit comments

Comments
 (0)