Skip to content

Commit 95a71d9

Browse files
razor-xseambot
andauthored
feat: Add SeamHttpEndpointPaginatedQueryPaths (#353)
* feat: Add SeamHttpEndpointPaginatedQueryPaths * ci: Format code * Update endpoints.ts * Update endpoints.hbs * ci: Generate code --------- Co-authored-by: Seam Bot <[email protected]>
1 parent 96df081 commit 95a71d9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

codegen/layouts/endpoints.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ export class SeamHttpEndpoints {
3838

3939
export type SeamHttpEndpointQueryPaths = {{#each endpointReadPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
4040

41+
export type SeamHttpEndpointPaginatedQueryPaths = {{#each endpointPaginatedPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
42+
4143
export type SeamHttpEndpointMutationPaths = {{#each endpointWritePaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}

codegen/lib/layouts/endpoints.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface EndpointsLayoutContext {
1111
className: string
1212
endpoints: EndpointLayoutContext[]
1313
endpointReadPaths: string[]
14+
endpointPaginatedPaths: string[]
1415
endpointWritePaths: string[]
1516
routeImports: RouteImportLayoutContext[]
1617
skipClientSessionImport: boolean
@@ -38,6 +39,14 @@ export const setEndpointsLayoutContext = (
3839
.filter(({ request }) => request.semanticMethod === 'GET')
3940
.map(({ path }) => path),
4041
)
42+
file.endpointPaginatedPaths = routes.flatMap((route) =>
43+
route.endpoints
44+
.filter(
45+
({ request, hasPagination }) =>
46+
request.semanticMethod === 'GET' && hasPagination,
47+
)
48+
.map(({ path }) => path),
49+
)
4150
file.endpointWritePaths = routes.flatMap((route) =>
4251
route.endpoints
4352
.filter(({ request }) => request.semanticMethod !== 'GET')

src/lib/seam/connect/routes/seam-http-endpoints.ts

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)