From 452c6ab8c3bebfb4db0d8358128b79e1ce1cecb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 06:31:13 +0000 Subject: [PATCH 1/2] feat(deps-dev): bump @seamapi/types in the seam group --- updated-dependencies: - dependency-name: "@seamapi/types" dependency-version: 1.461.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: seam ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index cba2175f..82f9f85c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@seamapi/blueprint": "^0.51.1", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.4.4", - "@seamapi/types": "1.459.0", + "@seamapi/types": "1.461.0", "@swc/core": "^1.11.29", "@types/eslint": "^8.44.2", "@types/jsonwebtoken": "^9.0.6", @@ -1216,9 +1216,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.459.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.459.0.tgz", - "integrity": "sha512-s1reaSsPsOj4+ZDV0BGEmswL+b278Ok59A8iPX27Xb0H6Xise3FA4tnVP5IgttOuvxXebH8IoV/y300cDs+kuQ==", + "version": "1.461.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.461.0.tgz", + "integrity": "sha512-e077CCv/Uhp2XBxYNFHHwYVSpjPxKywl5a/0P3jQqGeSMj4Vix28JTFig3DaDxD0+HjcNuT1wS2HMu6yuluhgw==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index eab9b796..72f5d259 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "@seamapi/blueprint": "^0.51.1", "@seamapi/fake-seam-connect": "^1.77.0", "@seamapi/smith": "^0.4.4", - "@seamapi/types": "1.459.0", + "@seamapi/types": "1.461.0", "@swc/core": "^1.11.29", "@types/eslint": "^8.44.2", "@types/jsonwebtoken": "^9.0.6", From 676ca20b312f85d24e2248619c26dde1322e7672 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Tue, 22 Jul 2025 06:32:15 +0000 Subject: [PATCH 2/2] ci: Generate code --- package-lock.json | 2 +- package.json | 2 +- src/lib/seam/connect/routes/index.ts | 1 + .../seam/connect/routes/instant-keys/index.ts | 6 + .../routes/instant-keys/instant-keys.ts | 200 ++++++++++++++++++ .../connect/routes/seam-http-endpoints.ts | 44 ++-- src/lib/seam/connect/routes/seam-http.ts | 5 + .../seam/connect/routes/seam/console/v1/v1.ts | 36 ++-- 8 files changed, 264 insertions(+), 32 deletions(-) create mode 100644 src/lib/seam/connect/routes/instant-keys/index.ts create mode 100644 src/lib/seam/connect/routes/instant-keys/instant-keys.ts diff --git a/package-lock.json b/package-lock.json index 82f9f85c..1bfd9757 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.459.0" + "@seamapi/types": "^1.461.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/package.json b/package.json index 72f5d259..71765d95 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "npm": ">=10.1.0" }, "peerDependencies": { - "@seamapi/types": "^1.459.0" + "@seamapi/types": "^1.461.0" }, "peerDependenciesMeta": { "@seamapi/types": { diff --git a/src/lib/seam/connect/routes/index.ts b/src/lib/seam/connect/routes/index.ts index a667e3df..27f8a963 100644 --- a/src/lib/seam/connect/routes/index.ts +++ b/src/lib/seam/connect/routes/index.ts @@ -15,6 +15,7 @@ export * from './connected-accounts/index.js' export * from './customers/index.js' export * from './devices/index.js' export * from './events/index.js' +export * from './instant-keys/index.js' export * from './locks/index.js' export * from './noise-sensors/index.js' export * from './phones/index.js' diff --git a/src/lib/seam/connect/routes/instant-keys/index.ts b/src/lib/seam/connect/routes/instant-keys/index.ts new file mode 100644 index 00000000..ddb0dc72 --- /dev/null +++ b/src/lib/seam/connect/routes/instant-keys/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 './instant-keys.js' diff --git a/src/lib/seam/connect/routes/instant-keys/instant-keys.ts b/src/lib/seam/connect/routes/instant-keys/instant-keys.ts new file mode 100644 index 00000000..c229c953 --- /dev/null +++ b/src/lib/seam/connect/routes/instant-keys/instant-keys.ts @@ -0,0 +1,200 @@ +/* + * 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 SeamHttpInstantKeys { + 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 = {}, + ): SeamHttpInstantKeys { + const constructorOptions = { ...options, client } + if (!isSeamHttpOptionsWithClient(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing client') + } + return new SeamHttpInstantKeys(constructorOptions) + } + + static fromApiKey( + apiKey: SeamHttpOptionsWithApiKey['apiKey'], + options: Omit = {}, + ): SeamHttpInstantKeys { + const constructorOptions = { ...options, apiKey } + if (!isSeamHttpOptionsWithApiKey(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing apiKey') + } + return new SeamHttpInstantKeys(constructorOptions) + } + + static fromClientSessionToken( + clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'], + options: Omit< + SeamHttpOptionsWithClientSessionToken, + 'clientSessionToken' + > = {}, + ): SeamHttpInstantKeys { + const constructorOptions = { ...options, clientSessionToken } + if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError('Missing clientSessionToken') + } + return new SeamHttpInstantKeys(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 SeamHttpInstantKeys.fromPublishableKey', + ) + } + const client = createClient(clientOptions) + const clientSessions = SeamHttpClientSessions.fromClient(client) + const { token } = await clientSessions.getOrCreate({ + user_identifier_key: userIdentifierKey, + }) + return SeamHttpInstantKeys.fromClientSessionToken(token, options) + } + + static fromConsoleSessionToken( + consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], + workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithConsoleSessionToken, + 'consoleSessionToken' | 'workspaceId' + > = {}, + ): SeamHttpInstantKeys { + const constructorOptions = { ...options, consoleSessionToken, workspaceId } + if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing consoleSessionToken or workspaceId', + ) + } + return new SeamHttpInstantKeys(constructorOptions) + } + + static fromPersonalAccessToken( + personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], + workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], + options: Omit< + SeamHttpOptionsWithPersonalAccessToken, + 'personalAccessToken' | 'workspaceId' + > = {}, + ): SeamHttpInstantKeys { + const constructorOptions = { ...options, personalAccessToken, workspaceId } + if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) { + throw new SeamHttpInvalidOptionsError( + 'Missing personalAccessToken or workspaceId', + ) + } + return new SeamHttpInstantKeys(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() + } + + list( + parameters?: InstantKeysListParameters, + options: InstantKeysListOptions = {}, + ): InstantKeysListRequest { + return new SeamHttpRequest(this, { + pathname: '/instant_keys/list', + method: 'POST', + body: parameters, + responseKey: 'instant_keys', + options, + }) + } +} + +export type InstantKeysListParameters = RouteRequestBody<'/instant_keys/list'> + +/** + * @deprecated Use InstantKeysListParameters instead. + */ +export type InstantKeysListParams = InstantKeysListParameters + +/** + * @deprecated Use InstantKeysListRequest instead. + */ +export type InstantKeysListResponse = SetNonNullable< + Required> +> + +export type InstantKeysListRequest = SeamHttpRequest< + InstantKeysListResponse, + 'instant_keys' +> + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface InstantKeysListOptions {} diff --git a/src/lib/seam/connect/routes/seam-http-endpoints.ts b/src/lib/seam/connect/routes/seam-http-endpoints.ts index e8de3462..70253d0d 100644 --- a/src/lib/seam/connect/routes/seam-http-endpoints.ts +++ b/src/lib/seam/connect/routes/seam-http-endpoints.ts @@ -452,6 +452,12 @@ import { type EventsListRequest, SeamHttpEvents, } from './events/index.js' +import { + type InstantKeysListOptions, + type InstantKeysListParameters, + type InstantKeysListRequest, + SeamHttpInstantKeys, +} from './instant-keys/index.js' import { type LocksGetOptions, type LocksGetParameters, @@ -525,9 +531,9 @@ import { SeamHttpPhonesSimulate, } from './phones/simulate/index.js' import { - type SeamConsoleV1GetResourceTypeOptions, - type SeamConsoleV1GetResourceTypeParameters, - type SeamConsoleV1GetResourceTypeRequest, + type SeamConsoleV1GetResourceLocatorOptions, + type SeamConsoleV1GetResourceLocatorParameters, + type SeamConsoleV1GetResourceLocatorRequest, SeamHttpSeamConsoleV1, } from './seam/console/v1/index.js' import { @@ -2534,6 +2540,19 @@ export class SeamHttpEndpoints { } } + get ['/instant_keys/list'](): ( + parameters?: InstantKeysListParameters, + options?: InstantKeysListOptions, + ) => InstantKeysListRequest { + const { client, defaults } = this + return function instantKeysList( + ...args: Parameters + ): ReturnType { + const seam = SeamHttpInstantKeys.fromClient(client, defaults) + return seam.list(...args) + } + } + get ['/locks/get'](): ( parameters?: LocksGetParameters, options?: LocksGetOptions, @@ -2770,21 +2789,21 @@ export class SeamHttpEndpoints { } } - get ['/seam/console/v1/get_resource_type'](): ( - parameters?: SeamConsoleV1GetResourceTypeParameters, - options?: SeamConsoleV1GetResourceTypeOptions, - ) => SeamConsoleV1GetResourceTypeRequest { + get ['/seam/console/v1/get_resource_locator'](): ( + parameters?: SeamConsoleV1GetResourceLocatorParameters, + options?: SeamConsoleV1GetResourceLocatorOptions, + ) => SeamConsoleV1GetResourceLocatorRequest { const { client, defaults } = this if (!this.defaults.isUndocumentedApiEnabled) { throw new Error( 'Cannot use undocumented API without isUndocumentedApiEnabled', ) } - return function seamConsoleV1GetResourceType( - ...args: Parameters - ): ReturnType { + return function seamConsoleV1GetResourceLocator( + ...args: Parameters + ): ReturnType { const seam = SeamHttpSeamConsoleV1.fromClient(client, defaults) - return seam.getResourceType(...args) + return seam.getResourceLocator(...args) } } @@ -4205,6 +4224,7 @@ export type SeamHttpEndpointQueryPaths = | '/devices/unmanaged/list' | '/events/get' | '/events/list' + | '/instant_keys/list' | '/locks/get' | '/locks/list' | '/noise_sensors/list' @@ -4212,7 +4232,7 @@ export type SeamHttpEndpointQueryPaths = | '/noise_sensors/noise_thresholds/list' | '/phones/get' | '/phones/list' - | '/seam/console/v1/get_resource_type' + | '/seam/console/v1/get_resource_locator' | '/seam/customer/v1/automation_runs/list' | '/seam/customer/v1/automations/get' | '/seam/customer/v1/portals/get' diff --git a/src/lib/seam/connect/routes/seam-http.ts b/src/lib/seam/connect/routes/seam-http.ts index 6f320db5..3db87d13 100644 --- a/src/lib/seam/connect/routes/seam-http.ts +++ b/src/lib/seam/connect/routes/seam-http.ts @@ -44,6 +44,7 @@ import { SeamHttpConnectedAccounts } from './connected-accounts/index.js' import { SeamHttpCustomers } from './customers/index.js' import { SeamHttpDevices } from './devices/index.js' import { SeamHttpEvents } from './events/index.js' +import { SeamHttpInstantKeys } from './instant-keys/index.js' import { SeamHttpLocks } from './locks/index.js' import { SeamHttpNoiseSensors } from './noise-sensors/index.js' import { SeamHttpPhones } from './phones/index.js' @@ -232,6 +233,10 @@ export class SeamHttp { return SeamHttpEvents.fromClient(this.client, this.defaults) } + get instantKeys(): SeamHttpInstantKeys { + return SeamHttpInstantKeys.fromClient(this.client, this.defaults) + } + get locks(): SeamHttpLocks { return SeamHttpLocks.fromClient(this.client, this.defaults) } diff --git a/src/lib/seam/connect/routes/seam/console/v1/v1.ts b/src/lib/seam/connect/routes/seam/console/v1/v1.ts index c734c9e4..dc9f7179 100644 --- a/src/lib/seam/connect/routes/seam/console/v1/v1.ts +++ b/src/lib/seam/connect/routes/seam/console/v1/v1.ts @@ -168,45 +168,45 @@ export class SeamHttpSeamConsoleV1 { await clientSessions.get() } - getResourceType( - parameters?: SeamConsoleV1GetResourceTypeParameters, - options: SeamConsoleV1GetResourceTypeOptions = {}, - ): SeamConsoleV1GetResourceTypeRequest { + getResourceLocator( + parameters?: SeamConsoleV1GetResourceLocatorParameters, + options: SeamConsoleV1GetResourceLocatorOptions = {}, + ): SeamConsoleV1GetResourceLocatorRequest { if (!this.defaults.isUndocumentedApiEnabled) { throw new Error( 'Cannot use undocumented API without isUndocumentedApiEnabled', ) } return new SeamHttpRequest(this, { - pathname: '/seam/console/v1/get_resource_type', + pathname: '/seam/console/v1/get_resource_locator', method: 'GET', params: parameters, - responseKey: 'resource_type', + responseKey: 'resource_locator', options, }) } } -export type SeamConsoleV1GetResourceTypeParameters = - RouteRequestParams<'/seam/console/v1/get_resource_type'> +export type SeamConsoleV1GetResourceLocatorParameters = + RouteRequestParams<'/seam/console/v1/get_resource_locator'> /** - * @deprecated Use SeamConsoleV1GetResourceTypeParameters instead. + * @deprecated Use SeamConsoleV1GetResourceLocatorParameters instead. */ -export type SeamConsoleV1GetResourceTypeParams = - SeamConsoleV1GetResourceTypeParameters +export type SeamConsoleV1GetResourceLocatorParams = + SeamConsoleV1GetResourceLocatorParameters /** - * @deprecated Use SeamConsoleV1GetResourceTypeRequest instead. + * @deprecated Use SeamConsoleV1GetResourceLocatorRequest instead. */ -export type SeamConsoleV1GetResourceTypeResponse = SetNonNullable< - Required> +export type SeamConsoleV1GetResourceLocatorResponse = SetNonNullable< + Required> > -export type SeamConsoleV1GetResourceTypeRequest = SeamHttpRequest< - SeamConsoleV1GetResourceTypeResponse, - 'resource_type' +export type SeamConsoleV1GetResourceLocatorRequest = SeamHttpRequest< + SeamConsoleV1GetResourceLocatorResponse, + 'resource_locator' > // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface SeamConsoleV1GetResourceTypeOptions {} +export interface SeamConsoleV1GetResourceLocatorOptions {}