From 200006efa3ef7f8c8d137b41dd57d88549ef8d75 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 16 Jan 2026 12:37:07 +0000 Subject: [PATCH 1/2] feat: Update to @seamapi/types@1.709.0 --- package-lock.json | 8 +- package.json | 2 +- .../connect/routes/seam-http-endpoints.ts | 20 ++ src/lib/seam/connect/routes/seam/index.ts | 1 + .../routes/seam/v1/customers/customers.ts | 197 ++++++++++++++++++ .../connect/routes/seam/v1/customers/index.ts | 6 + src/lib/seam/connect/routes/seam/v1/index.ts | 7 + src/lib/seam/connect/routes/seam/v1/v1.ts | 168 +++++++++++++++ 8 files changed, 404 insertions(+), 5 deletions(-) create mode 100644 src/lib/seam/connect/routes/seam/v1/customers/customers.ts create mode 100644 src/lib/seam/connect/routes/seam/v1/customers/index.ts create mode 100644 src/lib/seam/connect/routes/seam/v1/index.ts create mode 100644 src/lib/seam/connect/routes/seam/v1/v1.ts diff --git a/package-lock.json b/package-lock.json index d17727a9..a3fb3889 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@seamapi/blueprint": "^0.52.2", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.701.0", + "@seamapi/types": "1.709.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", @@ -1388,9 +1388,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.701.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.701.0.tgz", - "integrity": "sha512-UO6oKVPIHg8+Xv76GSgIsO33A1TvjxA3FNLT8hhsGQ2c/+BK0BYWt33IV0dltLJVEVu99He3MzDyOvu6oAocSQ==", + "version": "1.709.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.709.0.tgz", + "integrity": "sha512-t+TeNgvYcOl4IqV2EmQVP8CFQI3XbnPF3u+fC1ZmNMP6S2HWBCLw8EfxPJmnFhdF7rJI7D+zStLmqk1lB0R3fg==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index d3df39e0..48c9d949 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "@seamapi/blueprint": "^0.52.2", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.5.2", - "@seamapi/types": "1.701.0", + "@seamapi/types": "1.709.0", "@swc/core": "^1.11.29", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^22.15.21", diff --git a/src/lib/seam/connect/routes/seam-http-endpoints.ts b/src/lib/seam/connect/routes/seam-http-endpoints.ts index d94c0217..1d915fc4 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -707,6 +707,12 @@ import { type SeamPartnerV1BuildingBlocksSpacesAutoMapParameters, type SeamPartnerV1BuildingBlocksSpacesAutoMapRequest, } from './seam/partner/v1/building-blocks/spaces/index.js' +import { + SeamHttpSeamV1Customers, + type SeamV1CustomersPushDataOptions, + type SeamV1CustomersPushDataParameters, + type SeamV1CustomersPushDataRequest, +} from './seam/v1/customers/index.js' import { SeamHttpSpaces, type SpacesAddAcsEntrancesOptions, @@ -3616,6 +3622,19 @@ export class SeamHttpEndpoints { } } + get '/seam/v1/customers/push_data'(): ( + parameters?: SeamV1CustomersPushDataParameters, + options?: SeamV1CustomersPushDataOptions, + ) => SeamV1CustomersPushDataRequest { + const { client, defaults } = this + return function seamV1CustomersPushData( + ...args: Parameters + ): ReturnType { + const seam = SeamHttpSeamV1Customers.fromClient(client, defaults) + return seam.pushData(...args) + } + } + get '/spaces/add_acs_entrances'(): ( parameters?: SpacesAddAcsEntrancesParameters, options?: SpacesAddAcsEntrancesOptions, @@ -4937,6 +4956,7 @@ export type SeamHttpEndpointMutationPaths = | '/seam/customer/v1/customers/open_portal' | '/seam/customer/v1/settings/update' | '/seam/customer/v1/spaces/create' + | '/seam/v1/customers/push_data' | '/spaces/add_acs_entrances' | '/spaces/add_devices' | '/spaces/create' diff --git a/src/lib/seam/connect/routes/seam/index.ts b/src/lib/seam/connect/routes/seam/index.ts index 2ed07d2c..ff5baa89 100644 --- a/src/lib/seam/connect/routes/seam/index.ts +++ b/src/lib/seam/connect/routes/seam/index.ts @@ -6,3 +6,4 @@ export * from './console/index.js' export * from './customer/index.js' export * from './partner/index.js' +export * from './v1/index.js' diff --git a/src/lib/seam/connect/routes/seam/v1/customers/customers.ts b/src/lib/seam/connect/routes/seam/v1/customers/customers.ts new file mode 100644 index 00000000..23e14126 --- /dev/null +++ b/src/lib/seam/connect/routes/seam/v1/customers/customers.ts @@ -0,0 +1,197 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect' + +import { seamApiLtsVersion } from 'lib/lts-version.js' +import { + getAuthHeadersForClientSessionToken, + warnOnInsecureuserIdentifierKey, +} from 'lib/seam/connect/auth.js' +import { type Client, createClient } from 'lib/seam/connect/client.js' +import { + isSeamHttpOptionsWithApiKey, + isSeamHttpOptionsWithClient, + isSeamHttpOptionsWithClientSessionToken, + isSeamHttpOptionsWithConsoleSessionToken, + isSeamHttpOptionsWithPersonalAccessToken, + type SeamHttpFromPublishableKeyOptions, + SeamHttpInvalidOptionsError, + type SeamHttpOptions, + type SeamHttpOptionsWithApiKey, + type SeamHttpOptionsWithClient, + type SeamHttpOptionsWithClientSessionToken, + type SeamHttpOptionsWithConsoleSessionToken, + type SeamHttpOptionsWithPersonalAccessToken, + type SeamHttpRequestOptions, +} from 'lib/seam/connect/options.js' +import { + limitToSeamHttpRequestOptions, + parseOptions, +} from 'lib/seam/connect/parse-options.js' +import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js' +import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js' +import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js' +import type { SetNonNullable } from 'lib/types.js' + +export class SeamHttpSeamV1Customers { + client: Client + readonly defaults: Required + readonly ltsVersion = seamApiLtsVersion + static ltsVersion = seamApiLtsVersion + + constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) { + const options = parseOptions(apiKeyOrOptions) + this.client = 'client' in options ? options.client : createClient(options) + this.defaults = limitToSeamHttpRequestOptions(options) + } + + static fromClient( + client: SeamHttpOptionsWithClient['client'], + options: Omit = {}, + ): SeamHttpSeamV1Customers { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamV1Customers(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamV1Customers { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamV1Customers(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamV1Customers { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamV1Customers(constructorOptions) + } + + static async fromPublishableKey( + publishableKey: string, + userIdentifierKey: string, + options: SeamHttpFromPublishableKeyOptions = {}, + ): Promise { + warnOnInsecureuserIdentifierKey(userIdentifierKey) + const clientOptions = parseOptions({ ...options, publishableKey }) + if (isSeamHttpOptionsWithClient(clientOptions)) { + throw new SeamHttpInvalidOptionsError( + 'The client option cannot be used with SeamHttpSeamV1Customers.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamV1Customers.fromClientSessionToken(token, options) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamV1Customers { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamV1Customers(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamV1Customers { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamV1Customers(constructorOptions) + } + + createPaginator( + request: SeamHttpRequest, + ): SeamPaginator { + return new SeamPaginator(this, request) + } + + async updateClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + ): Promise { + const { headers } = this.client.defaults + const authHeaders = getAuthHeadersForClientSessionToken({ + clientSessionToken, + }) + for (const key of Object.keys(authHeaders)) { + if (headers[key] == null) { + throw new Error( + 'Cannot update a clientSessionToken on a client created without a clientSessionToken', + ) + } + } + this.client.defaults.headers = { ...headers, ...authHeaders } + const clientSessions = SeamHttpClientSessions.fromClient(this.client) + await clientSessions.get() + } + + pushData( + parameters?: SeamV1CustomersPushDataParameters, + options: SeamV1CustomersPushDataOptions = {}, + ): SeamV1CustomersPushDataRequest { + return new SeamHttpRequest(this, { + pathname: '/seam/v1/customers/push_data', + method: 'POST', + body: parameters, + responseKey: undefined, + options, + }) + } +} + +export type SeamV1CustomersPushDataParameters = + RouteRequestBody<'/seam/v1/customers/push_data'> + +/** + * @deprecated Use SeamV1CustomersPushDataParameters instead. + */ +export type SeamV1CustomersPushDataBody = SeamV1CustomersPushDataParameters + +/** + * @deprecated Use SeamV1CustomersPushDataRequest instead. + */ +export type SeamV1CustomersPushDataResponse = SetNonNullable< + Required> +> + +export type SeamV1CustomersPushDataRequest = SeamHttpRequest + +export interface SeamV1CustomersPushDataOptions {} diff --git a/src/lib/seam/connect/routes/seam/v1/customers/index.ts b/src/lib/seam/connect/routes/seam/v1/customers/index.ts new file mode 100644 index 00000000..9126f05d --- /dev/null +++ b/src/lib/seam/connect/routes/seam/v1/customers/index.ts @@ -0,0 +1,6 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +export * from './customers.js' diff --git a/src/lib/seam/connect/routes/seam/v1/index.ts b/src/lib/seam/connect/routes/seam/v1/index.ts new file mode 100644 index 00000000..60e5d0bd --- /dev/null +++ b/src/lib/seam/connect/routes/seam/v1/index.ts @@ -0,0 +1,7 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +export * from './customers/index.js' +export * from './v1.js' diff --git a/src/lib/seam/connect/routes/seam/v1/v1.ts b/src/lib/seam/connect/routes/seam/v1/v1.ts new file mode 100644 index 00000000..a966fe8d --- /dev/null +++ b/src/lib/seam/connect/routes/seam/v1/v1.ts @@ -0,0 +1,168 @@ +/* + * Automatically generated by codegen/smith.ts. + * Do not edit this file or add other files to this directory. + */ + +import { seamApiLtsVersion } from 'lib/lts-version.js' +import { + getAuthHeadersForClientSessionToken, + warnOnInsecureuserIdentifierKey, +} from 'lib/seam/connect/auth.js' +import { type Client, createClient } from 'lib/seam/connect/client.js' +import { + isSeamHttpOptionsWithApiKey, + isSeamHttpOptionsWithClient, + isSeamHttpOptionsWithClientSessionToken, + isSeamHttpOptionsWithConsoleSessionToken, + isSeamHttpOptionsWithPersonalAccessToken, + type SeamHttpFromPublishableKeyOptions, + SeamHttpInvalidOptionsError, + type SeamHttpOptions, + type SeamHttpOptionsWithApiKey, + type SeamHttpOptionsWithClient, + type SeamHttpOptionsWithClientSessionToken, + type SeamHttpOptionsWithConsoleSessionToken, + type SeamHttpOptionsWithPersonalAccessToken, + type SeamHttpRequestOptions, +} from 'lib/seam/connect/options.js' +import { + limitToSeamHttpRequestOptions, + parseOptions, +} from 'lib/seam/connect/parse-options.js' +import { SeamHttpClientSessions } from 'lib/seam/connect/routes/client-sessions/index.js' +import type { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js' +import { SeamPaginator } from 'lib/seam/connect/seam-paginator.js' + +import { SeamHttpSeamV1Customers } from './customers/index.js' + +export class SeamHttpSeamV1 { + client: Client + readonly defaults: Required + readonly ltsVersion = seamApiLtsVersion + static ltsVersion = seamApiLtsVersion + + constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) { + const options = parseOptions(apiKeyOrOptions) + this.client = 'client' in options ? options.client : createClient(options) + this.defaults = limitToSeamHttpRequestOptions(options) + } + + static fromClient( + client: SeamHttpOptionsWithClient['client'], + options: Omit = {}, + ): SeamHttpSeamV1 { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpSeamV1(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpSeamV1 { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpSeamV1(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpSeamV1 { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpSeamV1(constructorOptions) + } + + static async fromPublishableKey( + publishableKey: string, + userIdentifierKey: string, + options: SeamHttpFromPublishableKeyOptions = {}, + ): Promise { + warnOnInsecureuserIdentifierKey(userIdentifierKey) + const clientOptions = parseOptions({ ...options, publishableKey }) + if (isSeamHttpOptionsWithClient(clientOptions)) { + throw new SeamHttpInvalidOptionsError( + 'The client option cannot be used with SeamHttpSeamV1.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpSeamV1.fromClientSessionToken(token, options) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamV1 { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpSeamV1(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpSeamV1 { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpSeamV1(constructorOptions) + } + + createPaginator( + request: SeamHttpRequest, + ): SeamPaginator { + return new SeamPaginator(this, request) + } + + async updateClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + ): Promise { + const { headers } = this.client.defaults + const authHeaders = getAuthHeadersForClientSessionToken({ + clientSessionToken, + }) + for (const key of Object.keys(authHeaders)) { + if (headers[key] == null) { + throw new Error( + 'Cannot update a clientSessionToken on a client created without a clientSessionToken', + ) + } + } + this.client.defaults.headers = { ...headers, ...authHeaders } + const clientSessions = SeamHttpClientSessions.fromClient(this.client) + await clientSessions.get() + } + + get customers(): SeamHttpSeamV1Customers { + return SeamHttpSeamV1Customers.fromClient(this.client, this.defaults) + } +} From 40705fb4f9da103e8adb606381eb8597ff581c21 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Fri, 16 Jan 2026 12:37:47 +0000 Subject: [PATCH 2/2] ci: Generate code --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3fb3889..ada2d0de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.701.0" + "@seamapi/types": "^1.709.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/package.json b/package.json index 48c9d949..cfda1acd 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.701.0" + "@seamapi/types": "^1.709.0" }, "peerDependenciesMeta": { "@seamapi/types": {