-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(showcase): add tanstack usage for server state
feat: regenerate sdk with revivers feat: core model for Pet feat(tanstack): add localStorage
- Loading branch information
Showing
53 changed files
with
1,831 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"contacts": [ | ||
{ | ||
"id": "1", | ||
"firstName": "Winnie", | ||
"lastName": "The Pooh" | ||
}, | ||
{ | ||
"id": "2", | ||
"firstName": "Christopher", | ||
"lastName": "Robin" | ||
}, | ||
{ | ||
"id": "3", | ||
"firstName": "Eyeore", | ||
"lastName": "The Donkey" | ||
}, | ||
{ | ||
"id": "5", | ||
"firstName": "Scrooge", | ||
"lastName": "McDuck" | ||
}, | ||
{ | ||
"id": "6", | ||
"firstName": "Tinker", | ||
"lastName": "Bell" | ||
}, | ||
{ | ||
"id": "7", | ||
"firstName": "Peter", | ||
"lastName": "Pan" | ||
}, | ||
{ | ||
"id": "8", | ||
"firstName": "Capitan", | ||
"lastName": "Hook" | ||
}, | ||
{ | ||
"id": "9", | ||
"firstName": "Snow", | ||
"lastName": "White" | ||
}, | ||
{ | ||
"id": "10", | ||
"firstName": "Prince", | ||
"lastName": "Charming" | ||
}, | ||
{ | ||
"id": "11", | ||
"firstName": "Fairy", | ||
"lastName": "Godmother" | ||
}, | ||
{ | ||
"id": "12", | ||
"firstName": "Simba", | ||
"lastName": "The Lion" | ||
}, | ||
{ | ||
"id": "13", | ||
"firstName": "Mufasa", | ||
"lastName": "The Lion King" | ||
}, | ||
{ | ||
"id": "14", | ||
"firstName": "Mike", | ||
"lastName": "Wazowski" | ||
}, | ||
{ | ||
"id": "15", | ||
"firstName": "James", | ||
"lastName": "P. Sullivan" | ||
}, | ||
{ | ||
"id": "16", | ||
"firstName": "Randall", | ||
"lastName": "Boggs" | ||
}, | ||
{ | ||
"id": "17", | ||
"firstName": "Buzz", | ||
"lastName": "Lightyear" | ||
}, | ||
{ | ||
"id": "18", | ||
"firstName": "Launchpad", | ||
"lastName": "McQuack" | ||
}, | ||
{ | ||
"id": "19", | ||
"firstName": "Minnie", | ||
"lastName": "Mouse" | ||
}, | ||
{ | ||
"id": "20", | ||
"firstName": "Mickey", | ||
"lastName": "Mouse" | ||
}, | ||
{ | ||
"id": "21", | ||
"firstName": "Donald", | ||
"lastName": "Duck" | ||
}, | ||
{ | ||
"id": "22", | ||
"firstName": "Daisy", | ||
"lastName": "Duck" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Tanstack usage | ||
|
||
the Tanstack query page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './tanstack.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { AsyncPipe } from '@angular/common'; | ||
import { AfterViewInit, ChangeDetectionStrategy, Component, QueryList, ViewChildren, ViewEncapsulation } from '@angular/core'; | ||
import { RouterLink } from '@angular/router'; | ||
import { O3rComponent } from '@o3r/core'; | ||
import { | ||
CopyTextPresComponent, | ||
IN_PAGE_NAV_PRES_DIRECTIVES, | ||
InPageNavLink, | ||
InPageNavLinkDirective, | ||
InPageNavPresService, | ||
TanstackPresComponent | ||
} from '../../components'; | ||
|
||
@O3rComponent({ componentType: 'Page' }) | ||
@Component({ | ||
selector: 'o3r-tanstack', | ||
standalone: true, | ||
imports: [ | ||
CopyTextPresComponent, | ||
RouterLink, | ||
TanstackPresComponent, | ||
IN_PAGE_NAV_PRES_DIRECTIVES, | ||
AsyncPipe | ||
], | ||
templateUrl: './tanstack.template.html', | ||
styleUrls: ['./tanstack.style.scss'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class TanstackComponent implements AfterViewInit { | ||
@ViewChildren(InPageNavLinkDirective) | ||
private readonly inPageNavLinkDirectives!: QueryList<InPageNavLink>; | ||
public links$ = this.inPageNavPresService.links$; | ||
|
||
constructor(private readonly inPageNavPresService: InPageNavPresService) {} | ||
|
||
public ngAfterViewInit() { | ||
this.inPageNavPresService.initialize(this.inPageNavLinkDirectives); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { PetApi } from '@ama-sdk/showcase-sdk'; | ||
import { PetApiFixture } from '@ama-sdk/showcase-sdk/fixtures'; | ||
import { AsyncPipe } from '@angular/common'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { TanstackComponent } from './tanstack.component'; | ||
import '@angular/localize/init'; | ||
|
||
describe('TanstackComponent', () => { | ||
let component: TanstackComponent; | ||
let fixture: ComponentFixture<TanstackComponent>; | ||
const petApiFixture = new PetApiFixture(); | ||
petApiFixture.findPetsByStatus = petApiFixture.findPetsByStatus.mockResolvedValue([]); | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
TanstackComponent, | ||
RouterModule.forRoot([]), | ||
AsyncPipe | ||
], | ||
providers: [ | ||
{provide: PetApi, useValue: petApiFixture} | ||
] | ||
}); | ||
fixture = TestBed.createComponent(TanstackComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<h1>SDK Generator</h1> | ||
<div class="row"> | ||
<div class="right-nav order-1 order-lg-2 col-12 col-lg-2 sticky-lg-top pt-5 pt-lg-0"> | ||
<o3r-in-page-nav-pres | ||
id="tanstack-nav" | ||
[links]="links$ | async" | ||
> | ||
</o3r-in-page-nav-pres> | ||
</div> | ||
<div class="order-2 order-lg-1 col-12 col-lg-10"> | ||
<h2 id="tanstack-description">Description</h2> | ||
<div> | ||
<p>This module provide generators to create an SDK that can be used to simplify the communication with an API.</p> | ||
<p>It also generates the Typescript classes matching the models of the API.</p> | ||
</div> | ||
|
||
<h2 id="tanstack-example">Example</h2> | ||
<div> | ||
<p> | ||
Let's try to use the API <a href="https://petstore3.swagger.io" target="_blank" rel="noopener">https://petstore3.swagger.io</a> | ||
<br> | ||
Fortunately, this API provides the specification as <a href="https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml" target="_blank" rel="noopener">Yaml file</a> | ||
that we can use to generate an SDK. | ||
<br> | ||
Here, you can check the <a href="https://github.com/AmadeusITGroup/otter/blob/main/packages/@ama-sdk/showcase-sdk" target="_blank" rel="noopener">generated SDK</a> | ||
</p> | ||
<o3r-tanstack-pres></o3r-tanstack-pres> | ||
<p> | ||
Do not hesitate to run the application locally, if not installed yet, follow the <a routerLink="/run-app-locally">instructions</a>. | ||
</p> | ||
<a href="https://github.com/AmadeusITGroup/otter/blob/main/apps/showcase/src/components/showcase/sdk" target="_blank" rel="noopener">Source code</a> | ||
</div> | ||
|
||
<h2 id="rules-engine-install">How to use</h2> | ||
<div> | ||
<o3r-copy-text-pres [wrap]="true" language="bash" text="yarn create @ama-sdk typescript <project-name> [--spec-path=./path/to/spec.yaml]"></o3r-copy-text-pres> | ||
</div> | ||
|
||
<h2 id="rules-engine-references">References</h2> | ||
<ul> | ||
<li> | ||
<a href="https://docs.otter.digitalforairlines.com/additional-documentation/api-sdk/sdk-models-hierarchy.html" target="_blank" rel="noopener">Documentation</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.