Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions codegen/lib/connect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Blueprint } from '@seamapi/blueprint'
import type { Blueprint, SeamAuthMethod } from '@seamapi/blueprint'
import { kebabCase } from 'change-case'
import type Metalsmith from 'metalsmith'

Expand All @@ -23,14 +23,34 @@ type File = RouteLayoutContext &

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

const supportedAuthMethods: SeamAuthMethod[] = [
'api_key',
'publishable_key',
'client_session_token',
'personal_access_token',
'console_session_token',
]

export const connect = (
files: Metalsmith.Files,
metalsmith: Metalsmith,
): void => {
const metadata = metalsmith.metadata() as Metadata
const {
blueprint: { namespaces, routes },
} = metadata
const { blueprint } = metadata

const routes = blueprint.routes
.filter((route) =>
route.endpoints.some((endpoint) =>
endpoint.authMethods.some((authMethod) =>
supportedAuthMethods.includes(authMethod),
),
),
)
.filter((route) => !route.path.startsWith('/seam/mobile_sdk'))

const namespaces = blueprint.namespaces.filter((namespace) =>
routes.some((route) => route.parentPath === namespace.path),
)

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

Expand Down
473 changes: 226 additions & 247 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@
}
},
"dependencies": {
"@seamapi/url-search-params-serializer": "^2.0.0-beta.2",
"@seamapi/url-search-params-serializer": "^2.0.0",
"axios": "^1.9.0",
"axios-retry": "^4.4.2"
},
"devDependencies": {
"@seamapi/blueprint": "^0.50.1",
"@seamapi/blueprint": "^0.51.0",
"@seamapi/fake-seam-connect": "^1.77.0",
"@seamapi/smith": "^0.4.4",
"@seamapi/types": "1.420.2",
Expand Down
252 changes: 0 additions & 252 deletions src/lib/seam/connect/routes/seam-http-endpoints.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/lib/seam/connect/routes/seam/bridge/index.ts

This file was deleted.

Loading