Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"inlinedDependencies": {
"iron-webcrypto": "2.0.0",
"jose": "6.2.1",
"jose": "6.2.2",
"uint8array-extras": "1.5.0"
}
}
3 changes: 3 additions & 0 deletions src/actions/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ describe('Actions', () => {
createdAt: '2024-10-22T17:12:50.746Z',
updatedAt: '2024-10-22T17:12:50.746Z',
externalId: null,
lastSignInAt: undefined,
locale: undefined,
metadata: {},
},
ipAddress: '50.141.123.10',
Expand All @@ -151,6 +153,7 @@ describe('Actions', () => {
id: '01JATCNVYCHT1SZGENR4QTXKRK',
userId: '01JATCHZVEC5EPANDPEZVM68Y9',
organizationId: '01JATCMZJY26PQ59XT9BNT0FNN',
organizationName: '',
role: {
slug: 'member',
},
Expand Down
3 changes: 2 additions & 1 deletion src/admin-portal/admin-portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export class AdminPortal {
*
* Generate a Portal Link scoped to an Organization.
* @param payload - Object containing organization.
* @returns {PortalLinkResponse}
* @returns {Promise<PortalLinkResponse>}
* @throws {BadRequestException} 400
* @throws {AuthorizationException} 403
* @throws {NotFoundException} 404
* @throws {UnprocessableEntityException} 422
*/
Expand Down
12 changes: 0 additions & 12 deletions src/admin-portal/fixtures/generate-link.fixture.json

This file was deleted.

6 changes: 0 additions & 6 deletions src/admin-portal/fixtures/intent-options.fixture.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/admin-portal/fixtures/sso-intent-options.fixture.json

This file was deleted.

3 changes: 3 additions & 0 deletions src/admin-portal/interfaces/generate-link.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export interface GenerateLink {
intent?: GenerateLinkIntent;
/** Options to configure the Admin Portal based on the intent. */
intentOptions?: IntentOptions;
/** The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. */
adminEmails?: string[];
}

export interface GenerateLinkResponse {
Expand All @@ -35,4 +37,5 @@ export interface GenerateLinkResponse {
organization: string;
intent?: GenerateLinkIntent;
intent_options?: IntentOptionsResponse;
admin_emails?: string[];
}
20 changes: 20 additions & 0 deletions src/api-keys/api-keys.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is auto-generated by oagen. Do not edit.

import { WorkOS } from '../workos';
import {
SerializedValidateApiKeyResponse,
Expand All @@ -9,6 +11,15 @@ import { deserializeValidateApiKeyResponse } from './serializers/validate-api-ke
export class ApiKeys {
constructor(private readonly workos: WorkOS) {}

/**
* Validate API key
*
* Validate an API key value and return the API key object if valid.
* @param payload - Object containing value.
* @returns {Promise<ApiKeyValidationResponse>}
* @throws {UnauthorizedException} 401
* @throws {UnprocessableEntityException} 422
*/
async validateApiKey(
payload: ValidateApiKeyOptions,
): Promise<ValidateApiKeyResponse> {
Expand All @@ -20,6 +31,15 @@ export class ApiKeys {
return deserializeValidateApiKeyResponse(data);
}

/**
* Delete an API key
*
* Permanently deletes an API key. This action cannot be undone. Once deleted, any requests using this API key will fail authentication.
* @param id - The unique ID of the API key.
* @example "api_key_01EHZNVPK3SFK441A1RGBFSHRT"
* @returns {Promise<void>}
* @throws {NotFoundException} 404
*/
async deleteApiKey(id: string): Promise<void> {
await this.workos.delete(`/api_keys/${id}`);
}
Expand Down
9 changes: 9 additions & 0 deletions src/api-keys/interfaces/api-key-owner.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is auto-generated by oagen. Do not edit.

import type {
ApiKeyWithValueOwner,
ApiKeyWithValueOwnerResponse,
} from '../../organizations/interfaces/api-key-with-value-owner.interface';

export type ApiKeyOwner = ApiKeyWithValueOwner;
export type ApiKeyOwnerResponse = ApiKeyWithValueOwnerResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is auto-generated by oagen. Do not edit.

import type { ApiKey, ApiKeyResponse } from './api-key.interface';

export interface ApiKeyValidationResponse {
apiKey: ApiKey | null;
}

export interface ApiKeyValidationResponseWire {
api_key: ApiKeyResponse | null;
}
14 changes: 14 additions & 0 deletions src/api-keys/interfaces/api-key-with-value-owner.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is auto-generated by oagen. Do not edit.

/** The entity that owns the API Key. */
export interface ApiKeyWithValueOwner {
/** The type of the API Key owner. */
type: 'organization';
/** Unique identifier of the API Key owner. */
id: string;
}

export interface ApiKeyWithValueOwnerResponse {
type: 'organization';
id: string;
}
42 changes: 42 additions & 0 deletions src/api-keys/interfaces/api-key-with-value.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// This file is auto-generated by oagen. Do not edit.

import type {
ApiKeyWithValueOwner,
ApiKeyWithValueOwnerResponse,
} from './api-key-with-value-owner.interface';

export interface ApiKeyWithValue {
/** Distinguishes the API Key object. */
object: 'api_key';
/** Unique identifier of the API Key. */
id: string;
/** The entity that owns the API Key. */
owner: ApiKeyWithValueOwner;
/** A descriptive name for the API Key. */
name: string;
/** An obfuscated representation of the API Key value. */
obfuscatedValue: string;
/** Timestamp of when the API Key was last used. */
lastUsedAt: string | null;
/** The permission slugs assigned to the API Key. */
permissions: string[];
/** An ISO 8601 timestamp. */
createdAt: string;
/** An ISO 8601 timestamp. */
updatedAt: string;
/** The full API Key value. Only returned once at creation time. */
value: string;
}

export interface ApiKeyWithValueResponse {
object: 'api_key';
id: string;
owner: ApiKeyWithValueOwnerResponse;
name: string;
obfuscated_value: string;
last_used_at: string | null;
permissions: string[];
created_at: string;
updated_at: string;
value: string;
}
25 changes: 25 additions & 0 deletions src/api-keys/interfaces/api-key.interface.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
// This file is auto-generated by oagen. Do not edit.

import type { ApiKeyOwnerResponse } from './api-key-owner.interface';
/** The API Key object if the value is valid, or `null` if invalid. */
export interface ApiKey {
/** Distinguishes the API Key object. */
object: 'api_key';
/** Unique identifier of the API Key. */
id: string;
/** The entity that owns the API Key. */
owner: {
type: 'organization';
id: string;
};
/** A descriptive name for the API Key. */
name: string;
/** An obfuscated representation of the API Key value. */
obfuscatedValue: string;
/** Timestamp of when the API Key was last used. */
lastUsedAt: string | null;
/** The permission slugs assigned to the API Key. */
permissions: string[];
/** An ISO 8601 timestamp. */
createdAt: string;
/** An ISO 8601 timestamp. */
updatedAt: string;
}

Expand All @@ -27,3 +40,15 @@ export interface SerializedApiKey {
created_at: string;
updated_at: string;
}

export interface ApiKeyResponse {
object: 'api_key';
id: string;
owner: ApiKeyOwnerResponse;
name: string;
obfuscated_value: string;
last_used_at: string | null;
permissions: string[];
created_at: string;
updated_at: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This file is auto-generated by oagen. Do not edit.

export interface CreateOrganizationApiKey {
/** The name for the API key. */
name: string;
/** The permission slugs to assign to the API key. */
permissions?: string[];
}

export interface CreateOrganizationApiKeyResponse {
name: string;
permissions?: string[];
}
5 changes: 5 additions & 0 deletions src/api-keys/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// This file is auto-generated by oagen. Do not edit.

export * from './api-key-owner.interface';
export * from './api-key-validation-response.interface';
export * from './api-key.interface';
export * from './create-organization-api-key-options.interface';
export * from './created-api-key.interface';
export * from './list-organization-api-keys-options.interface';
export * from './organizations-api-keys-order.interface';
export * from './validate-api-key.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file is auto-generated by oagen. Do not edit.

export type OrganizationsApiKeysOrder = 'normal' | 'desc' | 'asc';
8 changes: 8 additions & 0 deletions src/api-keys/interfaces/validate-api-key.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is auto-generated by oagen. Do not edit.

import { ApiKey, SerializedApiKey } from './api-key.interface';

export interface ValidateApiKeyOptions {
Expand All @@ -6,8 +8,14 @@ export interface ValidateApiKeyOptions {

export interface ValidateApiKeyResponse {
apiKey: ApiKey | null;
value?: string;
}

export interface SerializedValidateApiKeyResponse {
api_key: SerializedApiKey | null;
}

export interface ValidateApiKey {
/** The value for an API key. */
value?: string;
}
6 changes: 6 additions & 0 deletions src/api-keys/serializers/api-key-owner.serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is auto-generated by oagen. Do not edit.

export {
deserializeApiKeyCreatedDataOwner as deserializeApiKeyOwner,
serializeApiKeyCreatedDataOwner as serializeApiKeyOwner,
} from '../../common/serializers/api-key-created-data-owner.serializer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This file is auto-generated by oagen. Do not edit.

import type {
ApiKeyValidationResponse,
ApiKeyValidationResponseWire,
} from '../interfaces/api-key-validation-response.interface';
import { deserializeApiKey, serializeApiKey } from './api-key.serializer';

export const deserializeApiKeyValidationResponse = (
response: ApiKeyValidationResponseWire,
): ApiKeyValidationResponse => ({
apiKey: response.api_key != null ? deserializeApiKey(response.api_key) : null,
});

export const serializeApiKeyValidationResponse = (
model: ApiKeyValidationResponse,
): ApiKeyValidationResponseWire => ({
api_key: model.apiKey != null ? serializeApiKey(model.apiKey) : null,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is auto-generated by oagen. Do not edit.

export {
deserializeApiKeyCreatedDataOwner as deserializeApiKeyWithValueOwner,
serializeApiKeyCreatedDataOwner as serializeApiKeyWithValueOwner,
} from '../../common/serializers/api-key-created-data-owner.serializer';
40 changes: 40 additions & 0 deletions src/api-keys/serializers/api-key-with-value.serializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// This file is auto-generated by oagen. Do not edit.

import type {
ApiKeyWithValue,
ApiKeyWithValueResponse,
} from '../interfaces/api-key-with-value.interface';
import {
deserializeApiKeyWithValueOwner,
serializeApiKeyWithValueOwner,
} from './api-key-with-value-owner.serializer';

export const deserializeApiKeyWithValue = (
response: ApiKeyWithValueResponse,
): ApiKeyWithValue => ({
object: response.object,
id: response.id,
owner: deserializeApiKeyWithValueOwner(response.owner),
name: response.name,
obfuscatedValue: response.obfuscated_value,
lastUsedAt: response.last_used_at ?? null,
permissions: response.permissions,
createdAt: response.created_at,
updatedAt: response.updated_at,
value: response.value,
});

export const serializeApiKeyWithValue = (
model: ApiKeyWithValue,
): ApiKeyWithValueResponse => ({
object: model.object,
id: model.id,
owner: serializeApiKeyWithValueOwner(model.owner),
name: model.name,
obfuscated_value: model.obfuscatedValue,
last_used_at: model.lastUsedAt,
permissions: model.permissions,
created_at: model.createdAt,
updated_at: model.updatedAt,
value: model.value,
});
16 changes: 16 additions & 0 deletions src/api-keys/serializers/api-key.serializer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// This file is auto-generated by oagen. Do not edit.

import { ApiKey, SerializedApiKey } from '../interfaces/api-key.interface';
import type { ApiKeyResponse } from '../interfaces/api-key.interface';
import { serializeApiKeyOwner } from './api-key-owner.serializer';

export function deserializeApiKey(apiKey: SerializedApiKey): ApiKey {
return {
Expand All @@ -13,3 +17,15 @@ export function deserializeApiKey(apiKey: SerializedApiKey): ApiKey {
updatedAt: apiKey.updated_at,
};
}

export const serializeApiKey = (model: ApiKey): ApiKeyResponse => ({
object: model.object,
id: model.id,
owner: serializeApiKeyOwner(model.owner),
name: model.name,
obfuscated_value: model.obfuscatedValue,
last_used_at: model.lastUsedAt,
permissions: model.permissions,
created_at: model.createdAt,
updated_at: model.updatedAt,
});
Loading
Loading