Skip to content

Commit 24a6c91

Browse files
iteloclaude
andcommitted
Remove @seamapi/types/connect from generated output
Copy route-types.ts locally during codegen, define a local ActionAttempt type, and simplify openapi.ts to eliminate all consumer-facing imports from @seamapi/types/connect. This makes @seamapi/types a codegen-time devDependency only, not a peer dependency for consumers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4ec3c44 commit 24a6c91

File tree

77 files changed

+112392
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+112392
-211
lines changed

codegen/layouts/partials/route-imports.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
RouteRequestBody,
44
RouteRequestParams,
55
RouteResponse,
6-
} from '@seamapi/types/connect'
6+
} from 'lib/seam/connect/route-types.js'
77
import type { SetNonNullable } from 'lib/types.js'
88

99
import {

codegen/smith.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { dirname } from 'node:path'
1+
import { readFileSync, writeFileSync } from 'node:fs'
2+
import { dirname, resolve } from 'node:path'
23
import { fileURLToPath } from 'node:url'
34

45
import layouts from '@metalsmith/layouts'
@@ -10,6 +11,20 @@ import Metalsmith from 'metalsmith'
1011
import { connect, helpers } from './lib/index.js'
1112

1213
const rootDir = dirname(fileURLToPath(import.meta.url))
14+
const projectDir = resolve(rootDir, '..')
15+
16+
// Copy route-types.ts from @seamapi/types into the source tree so consumers
17+
// do not need @seamapi/types as a peer dependency.
18+
const routeTypesSrc = resolve(
19+
projectDir,
20+
'node_modules/@seamapi/types/src/lib/seam/connect/route-types.ts',
21+
)
22+
const routeTypesDest = resolve(
23+
projectDir,
24+
'src/lib/seam/connect/route-types.ts',
25+
)
26+
const header = `// This file is auto-generated during codegen from @seamapi/types.\n// Do not edit manually.\n\n`
27+
writeFileSync(routeTypesDest, header + readFileSync(routeTypesSrc, 'utf-8'))
1328

1429
await Promise.all([deleteAsync('./src/lib/seam/connect/routes')])
1530

package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,6 @@
8585
"node": ">=22.11.0",
8686
"npm": ">=10.9.4"
8787
},
88-
"peerDependencies": {
89-
"@seamapi/types": "^1.738.0"
90-
},
91-
"peerDependenciesMeta": {
92-
"@seamapi/types": {
93-
"optional": true
94-
}
95-
},
9688
"dependencies": {
9789
"@seamapi/url-search-params-serializer": "^3.0.0",
9890
"axios": "^1.9.0",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export type ActionAttempt =
2+
| {
3+
action_attempt_id: string
4+
status: 'pending'
5+
action_type: string
6+
result: null
7+
error: null
8+
}
9+
| {
10+
action_attempt_id: string
11+
status: 'success'
12+
action_type: string
13+
result: unknown
14+
error: null
15+
}
16+
| {
17+
action_attempt_id: string
18+
status: 'error'
19+
action_type: string
20+
result: null
21+
error: { type: string; message: string }
22+
}

src/lib/seam/connect/openapi.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import type { openapi } from '@seamapi/types/connect'
2-
31
import { createClient } from './client.js'
42
import { defaultEndpoint, sdkHeaders } from './parse-options.js'
53

64
export const getOpenapiSchema = async (
75
endpoint = defaultEndpoint,
8-
): Promise<typeof openapi> => {
6+
): Promise<Record<string, unknown>> => {
97
const client = createClient({
108
axiosOptions: {
119
baseURL: endpoint,
1210
headers: sdkHeaders,
1311
},
1412
})
15-
const { data } = await client.get<typeof openapi>('/openapi.json')
13+
const { data } = await client.get<Record<string, unknown>>('/openapi.json')
1614
return data
1715
}

src/lib/seam/connect/resolve-action-attempt.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { ActionAttempt } from '@seamapi/types/connect'
2-
1+
import type { ActionAttempt } from './action-attempt.js'
32
import type { SeamHttpActionAttempts } from './routes/index.js'
43

54
export interface ResolveActionAttemptOptions {

src/lib/seam/connect/route-types.ts

Lines changed: 112059 additions & 0 deletions
Large diffs are not rendered by default.

src/lib/seam/connect/routes/access-codes/access-codes.ts

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

src/lib/seam/connect/routes/access-codes/simulate/simulate.ts

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

src/lib/seam/connect/routes/access-codes/unmanaged/unmanaged.ts

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

0 commit comments

Comments
 (0)