Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .oagen-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,44 @@
"src/groups/serializers/index.ts",
"src/groups/serializers/update-group.serializer.ts",
"src/groups/serializers/user-organization-membership-base-list-data.serializer.ts",
"src/organizations/fixtures/audit-log-configuration-log-stream.json",
"src/organizations/fixtures/audit-log-configuration.json",
"src/organizations/fixtures/audit-logs-retention.json",
"src/organizations/fixtures/list-organization.json",
"src/organizations/fixtures/organization-domain-data.json",
"src/organizations/fixtures/organization-input.json",
"src/organizations/fixtures/organization.json",
"src/organizations/fixtures/update-audit-logs-retention.json",
"src/organizations/fixtures/update-organization.json",
"src/organizations/interfaces/audit-log-configuration-log-stream-state.interface.ts",
"src/organizations/interfaces/audit-log-configuration-log-stream-type.interface.ts",
"src/organizations/interfaces/audit-log-configuration-log-stream.interface.ts",
"src/organizations/interfaces/audit-log-configuration-state.interface.ts",
"src/organizations/interfaces/audit-log-configuration.interface.ts",
"src/organizations/interfaces/audit-logs-retention.interface.ts",
"src/organizations/interfaces/delete-organization-options.interface.ts",
"src/organizations/interfaces/get-audit-log-configuration-options.interface.ts",
"src/organizations/interfaces/get-organization-by-external-id-options.interface.ts",
"src/organizations/interfaces/get-organization-options.interface.ts",
"src/organizations/interfaces/index.ts",
"src/organizations/interfaces/organization-domain-data-state.interface.ts",
"src/organizations/interfaces/organization-domain-data.interface.ts",
"src/organizations/interfaces/organization-input.interface.ts",
"src/organizations/interfaces/organization.interface.ts",
"src/organizations/interfaces/update-audit-logs-retention.interface.ts",
"src/organizations/interfaces/update-organization.interface.ts",
"src/organizations/organizations.spec.ts",
"src/organizations/organizations.ts",
"src/organizations/serializers.spec.ts",
"src/organizations/serializers/audit-log-configuration-log-stream.serializer.ts",
"src/organizations/serializers/audit-log-configuration.serializer.ts",
"src/organizations/serializers/audit-logs-retention.serializer.ts",
"src/organizations/serializers/index.ts",
"src/organizations/serializers/organization-domain-data.serializer.ts",
"src/organizations/serializers/organization-input.serializer.ts",
"src/organizations/serializers/organization.serializer.ts",
"src/organizations/serializers/update-audit-logs-retention.serializer.ts",
"src/organizations/serializers/update-organization.serializer.ts",
"src/radar/fixtures/radar-list-entry-already-present-response.json",
"src/radar/fixtures/radar-standalone-assess-request.json",
"src/radar/fixtures/radar-standalone-delete-radar-list-entry-request.json",
Expand Down
4 changes: 2 additions & 2 deletions src/actions/actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ describe('Actions', () => {
name: 'Foo Corp',
allowProfilesOutsideOrganization: false,
domains: [],
createdAt: '2024-10-22T17:12:50.746Z',
updatedAt: '2024-10-22T17:12:50.746Z',
createdAt: new Date('2024-10-22T17:12:50.746Z'),
updatedAt: new Date('2024-10-22T17:12:50.746Z'),
externalId: null,
metadata: {},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "als_01EHZNVPK3SFK441A1RGBFSHRT",
"type": "Datadog",
"state": "active",
"last_synced_at": "2026-01-15T12:00:00.000Z",
"created_at": "2026-01-15T12:00:00.000Z"
}
12 changes: 12 additions & 0 deletions src/organizations/fixtures/audit-log-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
"retention_period_in_days": 30,
"state": "active",
"log_stream": {
"id": "als_01EHZNVPK3SFK441A1RGBFSHRT",
"type": "Datadog",
"state": "active",
"last_synced_at": "2026-01-15T12:00:00.000Z",
"created_at": "2026-01-15T12:00:00.000Z"
}
}
3 changes: 3 additions & 0 deletions src/organizations/fixtures/audit-logs-retention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"retention_period_in_days": 30
}
35 changes: 35 additions & 0 deletions src/organizations/fixtures/list-organization.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"data": [
{
"object": "organization",
"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
"name": "Acme Inc.",
"domains": [
{
"object": "organization_domain",
"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
"organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
"domain": "foo-corp.com",
"state": "pending",
"verification_prefix": "superapp-domain-verification-z3kjny",
"verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
"verification_strategy": "dns",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
],
"metadata": {
"tier": "diamond"
},
"external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
"stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z",
"allow_profiles_outside_organization": false
}
],
"list_metadata": {
"before": null,
"after": null
}
}
4 changes: 4 additions & 0 deletions src/organizations/fixtures/organization-domain-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"domain": "foo-corp.com",
"state": "verified"
}
15 changes: 15 additions & 0 deletions src/organizations/fixtures/organization-input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Foo Corp",
"allow_profiles_outside_organization": false,
"domains": ["example.com"],
"domain_data": [
{
"domain": "foo-corp.com",
"state": "verified"
}
],
"metadata": {
"tier": "diamond"
},
"external_id": "ext_12345"
}
27 changes: 27 additions & 0 deletions src/organizations/fixtures/organization.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"object": "organization",
"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY",
"name": "Acme Inc.",
"domains": [
{
"object": "organization_domain",
"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A",
"organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP",
"domain": "foo-corp.com",
"state": "pending",
"verification_prefix": "superapp-domain-verification-z3kjny",
"verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw",
"verification_strategy": "dns",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
],
"metadata": {
"tier": "diamond"
},
"external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191",
"stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z",
"allow_profiles_outside_organization": false
}
3 changes: 3 additions & 0 deletions src/organizations/fixtures/update-audit-logs-retention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"retention_period_in_days": 30
}
19 changes: 11 additions & 8 deletions src/organizations/fixtures/update-organization.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "Test Organization 2",
"object": "organization",
"id": "org_01EHT88Z8J8795GZNQ4ZP1J81T",
"name": "Foo Corp",
"allow_profiles_outside_organization": false,
"domains": [
"domains": ["foo-corp.com"],
"domain_data": [
{
"domain": "example.com",
"object": "organization_domain",
"id": "org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8"
"domain": "foo-corp.com",
"state": "verified"
}
]
],
"stripe_customer_id": "cus_R9qWAGMQ6nGE7V",
"metadata": {
"tier": "diamond"
},
"external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is auto-generated by oagen. Do not edit.

export const AuditLogConfigurationLogStreamState = {
Active: 'active',
Inactive: 'inactive',
Error: 'error',
Invalid: 'invalid',
} as const;

export type AuditLogConfigurationLogStreamState =
(typeof AuditLogConfigurationLogStreamState)[keyof typeof AuditLogConfigurationLogStreamState];
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is auto-generated by oagen. Do not edit.

export const AuditLogConfigurationLogStreamType = {
AzureSentinel: 'AzureSentinel',
Datadog: 'Datadog',
GenericHttps: 'GenericHttps',
GoogleCloudStorage: 'GoogleCloudStorage',
S3: 'S3',
Snowflake: 'Snowflake',
Splunk: 'Splunk',
} as const;

export type AuditLogConfigurationLogStreamType =
(typeof AuditLogConfigurationLogStreamType)[keyof typeof AuditLogConfigurationLogStreamType];
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file is auto-generated by oagen. Do not edit.

import type { AuditLogConfigurationLogStreamType } from './audit-log-configuration-log-stream-type.interface';
import type { AuditLogConfigurationLogStreamState } from './audit-log-configuration-log-stream-state.interface';

/** The Audit Log Stream currently configured for the organization, if any. */
export interface AuditLogConfigurationLogStream {
/** Unique identifier of the Audit Log Stream. */
id: string;
/** The type of the Audit Log Stream destination. */
type: AuditLogConfigurationLogStreamType;
/** The current state of the Audit Log Stream. */
state: AuditLogConfigurationLogStreamState;
/** ISO-8601 timestamp of when the last event was successfully synced, or null if no events have been synced. */
lastSyncedAt: string | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 lastSyncedAt stays a raw string while createdAt is a Date

createdAt: Date is deserialized via new Date(response.created_at) in the log-stream serializer, but lastSyncedAt: string | null is passed through as-is. Both fields hold ISO 8601 timestamps; keeping one as a raw string while the other is a Date is inconsistent and surprising for consumers. Consider converting lastSyncedAt to Date | null for consistency.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

/** An ISO 8601 timestamp. */
createdAt: Date;
}

export interface AuditLogConfigurationLogStreamResponse {
id: string;
type: AuditLogConfigurationLogStreamType;
state: AuditLogConfigurationLogStreamState;
last_synced_at: string | null;
created_at: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is auto-generated by oagen. Do not edit.

export const AuditLogConfigurationState = {
Active: 'active',
Inactive: 'inactive',
Disabled: 'disabled',
} as const;

export type AuditLogConfigurationState =
(typeof AuditLogConfigurationState)[keyof typeof AuditLogConfigurationState];
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This file is auto-generated by oagen. Do not edit.

import type {
AuditLogConfigurationLogStream,
AuditLogConfigurationLogStreamResponse,
} from './audit-log-configuration-log-stream.interface';
import type { AuditLogConfigurationState } from './audit-log-configuration-state.interface';

export interface AuditLogConfiguration {
/** Unique identifier of the Organization. */
organizationId: string;
/** The number of days Audit Log events will be retained before being permanently deleted. */
retentionPeriodInDays: number;
/** The current state of the audit log configuration for the organization. */
state: AuditLogConfigurationState;
/** The Audit Log Stream currently configured for the organization, if any. */
logStream?: AuditLogConfigurationLogStream;
}

export interface AuditLogConfigurationResponse {
organization_id: string;
retention_period_in_days: number;
state: AuditLogConfigurationState;
log_stream?: AuditLogConfigurationLogStreamResponse;
}
10 changes: 10 additions & 0 deletions src/organizations/interfaces/audit-logs-retention.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is auto-generated by oagen. Do not edit.

export interface AuditLogsRetention {
/** The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365. */
retentionPeriodInDays: number | null;
}

export interface AuditLogsRetentionResponse {
retention_period_in_days: number | null;
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { PostOptions } from '../../common/interfaces';
import { DomainData } from './domain-data.interface';
import { OrganizationDomainData } from './organization-domain-data.interface';

// CreateOrganizationOptions mirrors the generated OrganizationInput request body
// so it can be passed straight to serializeOrganizationInput. Kept hand-owned
// because oagen only generates path-param option interfaces.
export interface CreateOrganizationOptions {
/** The name of the organization. */
name: string;
domainData?: DomainData[];
/** Whether the organization allows profiles from outside the organization to sign in. */
allowProfilesOutsideOrganization?: boolean;
/** The domains associated with the organization. Deprecated in favor of `domain_data`. */
domains?: string[];
/** The domains associated with the organization, including verification state. */
domainData?: OrganizationDomainData[];
/** Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. */
metadata?: Record<string, string> | null;
/** An external identifier for the Organization. */
externalId?: string | null;
metadata?: Record<string, string>;
}

export interface SerializedCreateOrganizationOptions {
name: string;
domain_data?: DomainData[];
external_id?: string | null;
metadata?: Record<string, string>;
}

export type CreateOrganizationRequestOptions = Pick<
PostOptions,
'idempotencyKey'
>;
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 interface DeleteOrganizationOptions {
/** Unique identifier of the Organization. */
id: string;
}
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 interface GetAuditLogConfigurationOptions {
/** Unique identifier of the Organization. */
id: string;
}
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 interface GetOrganizationByExternalIdOptions {
/** The external ID of the Organization. */
externalId: string;
}
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 interface GetOrganizationOptions {
/** Unique identifier of the Organization. */
id: string;
}
17 changes: 17 additions & 0 deletions src/organizations/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
// This file is auto-generated by oagen. Do not edit.

export * from './audit-log-configuration-log-stream-state.interface';
export * from './audit-log-configuration-log-stream-type.interface';
export * from './audit-log-configuration-log-stream.interface';
export * from './audit-log-configuration-state.interface';
export * from './audit-log-configuration.interface';
export * from './audit-logs-retention.interface';
export * from './create-organization-options.interface';
export * from './delete-organization-options.interface';
export * from './domain-data.interface';
export * from './get-audit-log-configuration-options.interface';
export * from './get-organization-by-external-id-options.interface';
export * from './get-organization-options.interface';
export * from './list-organization-feature-flags-options.interface';
export * from './list-organizations-options.interface';
export * from './organization-domain-data-state.interface';
export * from './organization-domain-data.interface';
export * from './organization-input.interface';
export * from './organization.interface';
export * from './update-audit-logs-retention.interface';
export * from './update-organization-options.interface';
export * from './update-organization.interface';
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ import { PaginationOptions } from '../../common/interfaces/pagination-options.in
export interface ListOrganizationsOptions extends PaginationOptions {
/** The domains of an Organization. Any Organization with a matching domain will be returned. */
domains?: string[];
/** Searchable text for an Organization. Matches against the Organization name and domains. */
search?: string;
}
Loading