Skip to content

Commit 04d9221

Browse files
committed
fix: Only generate endpoints with supported auth method
1 parent 7334a9e commit 04d9221

File tree

17 files changed

+27
-1444
lines changed

17 files changed

+27
-1444
lines changed

codegen/lib/connect.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Blueprint } from '@seamapi/blueprint'
1+
import type { Blueprint, SeamAuthMethod } from '@seamapi/blueprint'
22
import { kebabCase } from 'change-case'
33
import type Metalsmith from 'metalsmith'
44

@@ -23,14 +23,32 @@ type File = RouteLayoutContext &
2323

2424
const rootPath = 'src/lib/seam/connect/routes'
2525

26+
const supportedAuthMethods: SeamAuthMethod[] = [
27+
'api_key',
28+
'publishable_key',
29+
'client_session_token',
30+
'personal_access_token',
31+
'console_session_token',
32+
]
33+
2634
export const connect = (
2735
files: Metalsmith.Files,
2836
metalsmith: Metalsmith,
2937
): void => {
3038
const metadata = metalsmith.metadata() as Metadata
31-
const {
32-
blueprint: { namespaces, routes },
33-
} = metadata
39+
const { blueprint } = metadata
40+
41+
const routes = blueprint.routes.filter((route) =>
42+
route.endpoints.some((endpoint) =>
43+
endpoint.authMethods.some((authMethod) =>
44+
supportedAuthMethods.includes(authMethod),
45+
),
46+
),
47+
)
48+
49+
const namespaces = blueprint.namespaces.filter((namespace) =>
50+
routes.some((route) => route.parentPath === namespace.path),
51+
)
3452

3553
const nodes = [...namespaces, ...routes]
3654

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"axios-retry": "^4.4.2"
9999
},
100100
"devDependencies": {
101-
"@seamapi/blueprint": "^0.50.1",
101+
"@seamapi/blueprint": "^0.51.0",
102102
"@seamapi/fake-seam-connect": "^1.77.0",
103103
"@seamapi/smith": "^0.4.4",
104104
"@seamapi/types": "1.420.2",

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

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

src/lib/seam/connect/routes/seam/bridge/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)