diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da1d89..41c60bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ adding additional type guards. ## Unreleased +### Added + +- Added `rotatable` to API key notifications to indicate whether an API key can be rotated. + --- ## 3.8.0 - 2026-04-20 diff --git a/package.json b/package.json index ce057b0..c818d18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paddle/paddle-node-sdk", - "version": "3.8.0", + "version": "3.9.0", "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.", "main": "dist/cjs/index.cjs.node.js", "module": "dist/esm/index.esm.node.js", diff --git a/src/__tests__/mocks/notifications/api-key-created.mock.ts b/src/__tests__/mocks/notifications/api-key-created.mock.ts index 8ebdec7..1d2b6c8 100644 --- a/src/__tests__/mocks/notifications/api-key-created.mock.ts +++ b/src/__tests__/mocks/notifications/api-key-created.mock.ts @@ -20,6 +20,7 @@ export const ApiKeyCreatedMock: IEventsResponse = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expires_at: '2025-06-26T06:58:38.517522Z', + rotatable: true, last_used_at: null, created_at: '2025-03-26T06:58:38.517522Z', updated_at: '2025-03-26T06:58:38.517522Z', @@ -39,6 +40,7 @@ export const ApiKeyCreatedMockExpectation = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expiresAt: '2025-06-26T06:58:38.517522Z', + rotatable: true, lastUsedAt: null, createdAt: '2025-03-26T06:58:38.517522Z', updatedAt: '2025-03-26T06:58:38.517522Z', diff --git a/src/__tests__/mocks/notifications/api-key-expired.mock.ts b/src/__tests__/mocks/notifications/api-key-expired.mock.ts index 0af542d..717a701 100644 --- a/src/__tests__/mocks/notifications/api-key-expired.mock.ts +++ b/src/__tests__/mocks/notifications/api-key-expired.mock.ts @@ -20,6 +20,7 @@ export const ApiKeyExpiredMock: IEventsResponse = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expires_at: '2025-06-26T06:58:38.517522Z', + rotatable: false, last_used_at: '2025-06-26T05:54:22.738201Z', created_at: '2025-03-26T06:58:38.517522Z', updated_at: '2025-03-26T06:58:38.517522Z', @@ -39,6 +40,7 @@ export const ApiKeyExpiredMockExpectation = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expiresAt: '2025-06-26T06:58:38.517522Z', + rotatable: false, lastUsedAt: '2025-06-26T05:54:22.738201Z', createdAt: '2025-03-26T06:58:38.517522Z', updatedAt: '2025-03-26T06:58:38.517522Z', diff --git a/src/__tests__/mocks/notifications/api-key-expiring.mock.ts b/src/__tests__/mocks/notifications/api-key-expiring.mock.ts index 5418b49..28012eb 100644 --- a/src/__tests__/mocks/notifications/api-key-expiring.mock.ts +++ b/src/__tests__/mocks/notifications/api-key-expiring.mock.ts @@ -20,6 +20,7 @@ export const ApiKeyExpiringMock: IEventsResponse = key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expires_at: '2025-06-26T06:58:38.517522Z', + rotatable: true, last_used_at: '2025-06-21T05:46:53.238201Z', created_at: '2025-03-26T06:58:38.517522Z', updated_at: '2025-03-26T06:58:38.517522Z', @@ -39,6 +40,7 @@ export const ApiKeyExpiringMockExpectation = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expiresAt: '2025-06-26T06:58:38.517522Z', + rotatable: true, lastUsedAt: '2025-06-21T05:46:53.238201Z', createdAt: '2025-03-26T06:58:38.517522Z', updatedAt: '2025-03-26T06:58:38.517522Z', diff --git a/src/__tests__/mocks/notifications/api-key-revoked.mock.ts b/src/__tests__/mocks/notifications/api-key-revoked.mock.ts index cf4a269..12f98eb 100644 --- a/src/__tests__/mocks/notifications/api-key-revoked.mock.ts +++ b/src/__tests__/mocks/notifications/api-key-revoked.mock.ts @@ -20,6 +20,7 @@ export const ApiKeyRevokedMock: IEventsResponse = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expires_at: '2025-06-26T06:58:38.517522Z', + rotatable: false, last_used_at: '2025-06-24T05:54:22.738201Z', created_at: '2025-03-26T06:58:38.517522Z', updated_at: '2025-06-24T12:58:38.746382Z', @@ -39,6 +40,7 @@ export const ApiKeyRevokedMockExpectation = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read', 'transaction.read'], expiresAt: '2025-06-26T06:58:38.517522Z', + rotatable: false, lastUsedAt: '2025-06-24T05:54:22.738201Z', createdAt: '2025-03-26T06:58:38.517522Z', updatedAt: '2025-06-24T12:58:38.746382Z', diff --git a/src/__tests__/mocks/notifications/api-key-updated.mock.ts b/src/__tests__/mocks/notifications/api-key-updated.mock.ts index 2b8c053..4a70ee1 100644 --- a/src/__tests__/mocks/notifications/api-key-updated.mock.ts +++ b/src/__tests__/mocks/notifications/api-key-updated.mock.ts @@ -20,6 +20,7 @@ export const ApiKeyUpdatedMock: IEventsResponse = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read'], expires_at: '2025-06-26T06:58:38.517522Z', + rotatable: true, last_used_at: '2025-04-21T11:35:42.428390Z', created_at: '2025-03-26T06:58:38.517522Z', updated_at: '2025-04-21T12:37:12.892738Z', @@ -39,6 +40,7 @@ export const ApiKeyUpdatedMockExpectation = { key: 'pdl_live_apikey_01jkdpbhaz****', permissions: ['address.read', 'business.read', 'customer.read', 'subscription.read'], expiresAt: '2025-06-26T06:58:38.517522Z', + rotatable: true, lastUsedAt: '2025-04-21T11:35:42.428390Z', createdAt: '2025-03-26T06:58:38.517522Z', updatedAt: '2025-04-21T12:37:12.892738Z', diff --git a/src/notifications/entities/api-key/api-key-notification.ts b/src/notifications/entities/api-key/api-key-notification.ts index 1491060..89eab8b 100644 --- a/src/notifications/entities/api-key/api-key-notification.ts +++ b/src/notifications/entities/api-key/api-key-notification.ts @@ -14,6 +14,7 @@ export class ApiKeyNotification { public readonly status: ApiKeyStatus; public readonly permissions: ApiKeyPermission[]; public readonly expiresAt: string | null; + public readonly rotatable: boolean | null; public readonly lastUsedAt: string | null; public readonly createdAt: string; public readonly updatedAt: string; @@ -26,6 +27,7 @@ export class ApiKeyNotification { this.status = apiKey.status; this.permissions = apiKey.permissions; this.expiresAt = apiKey.expires_at ?? null; + this.rotatable = apiKey.rotatable ?? null; this.lastUsedAt = apiKey.last_used_at ?? null; this.createdAt = apiKey.created_at; this.updatedAt = apiKey.updated_at; diff --git a/src/notifications/types/api-key/api-key-notification-response.ts b/src/notifications/types/api-key/api-key-notification-response.ts index bf36373..76d7687 100644 --- a/src/notifications/types/api-key/api-key-notification-response.ts +++ b/src/notifications/types/api-key/api-key-notification-response.ts @@ -14,6 +14,7 @@ export interface IApiKeyNotificationResponse { status: ApiKeyStatus; permissions: ApiKeyPermission[]; expires_at: string | null; + rotatable: boolean | null; last_used_at: string | null; created_at: string; updated_at: string;