Skip to content

Update Node SDK to include auditlogs.listSchemas#1457

Open
swaroopAkkineniWorkos wants to merge 17 commits intomainfrom
update-node-for-audit-logs
Open

Update Node SDK to include auditlogs.listSchemas#1457
swaroopAkkineniWorkos wants to merge 17 commits intomainfrom
update-node-for-audit-logs

Conversation

@swaroopAkkineniWorkos
Copy link
Contributor

@swaroopAkkineniWorkos swaroopAkkineniWorkos commented Feb 1, 2026

@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title init Update Node SDK to ensure that all audit-log api's are in it Feb 1, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

16 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@workos workos deleted a comment from greptile-apps bot Feb 1, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile re-review plz

@workos workos deleted a comment from greptile-apps bot Feb 1, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@workos workos deleted a comment from greptile-apps bot Feb 1, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile re-review plz

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@workos workos deleted a comment from greptile-apps bot Feb 1, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile re-review plz

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@workos workos deleted a comment from greptile-apps bot Feb 2, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile re-review plz

@swaroopAkkineniWorkos
Copy link
Contributor Author

@claude can you review and ensure it complies with the listSchema api

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@swaroopAkkineniWorkos swaroopAkkineniWorkos marked this pull request as ready for review February 2, 2026 15:22
@swaroopAkkineniWorkos swaroopAkkineniWorkos requested a review from a team as a code owner February 2, 2026 15:22
@swaroopAkkineniWorkos swaroopAkkineniWorkos requested review from a team, PavanKulkarni, ajworkos, atainter, csrbarber, katie-west, kendallstrautman and mattgd and removed request for a team February 2, 2026 15:22
@swaroopAkkineniWorkos swaroopAkkineniWorkos added the enhancement New feature or request label Feb 2, 2026
@swaroopAkkineniWorkos swaroopAkkineniWorkos changed the title Update Node SDK to ensure that all audit-log api's are in it Update Node SDK to include auditlogs.listSchemas Feb 2, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

}

export interface CreateAuditLogSchemaResponse {
export interface AuditLogSchemaResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is exported publicly, this would be a breaking change. Perhaps we can alias CreateAuditLogSchemaResponse to AuditLogSchemaResponse and mark CreateAuditLogSchemaResponse as deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattgd updated. Added the alias and also leaving all the exports in CreateAuditLogSchemaResponse as is and just exporting the types from the common, new audit log interface i made.

export interface AuditLogTargetSchema {
type: string;
metadata?: Record<string, string | boolean | number> | undefined;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to src/audit-logs/interfaces/audit-log-schema.interface.ts

@workos workos deleted a comment from greptile-apps bot Feb 2, 2026
@swaroopAkkineniWorkos
Copy link
Contributor Author

@greptile re-review plz

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 2, 2026

Greptile Overview

Greptile Summary

This PR adds support for the Audit Logs “List Schemas” endpoint by introducing AuditLogs.listSchemas, new schema-related interfaces (AuditLogSchema, AuditLogSchemaResponse, ListSchemasOptions), and tests that validate pagination and deserialization behavior. It reuses the existing audit log schema deserializer (originally for create schema) so both create/list return the same simplified metadata shape in the SDK.

Confidence Score: 4/5

  • This PR is likely safe to merge with low risk; changes are additive and covered by tests.
  • The new endpoint follows existing pagination/serialization patterns and includes comprehensive spec coverage. Remaining concerns are mainly type-shape ergonomics (properties typed as required-but-undefined) and minor import hygiene in tests, rather than runtime-breaking logic.
  • src/audit-logs/interfaces/audit-log-schema.interface.ts

Important Files Changed

Filename Overview
src/audit-logs/audit-logs.ts Adds auditLogs.listSchemas using fetchAndDeserialize + AutoPaginatable over /audit_logs/actions/{action}/schemas.
src/audit-logs/audit-logs.spec.ts Adds coverage for listSchemas including pagination and optional fields; minor import could be import type.
src/audit-logs/interfaces/audit-log-schema.interface.ts Introduces shared schema types for create/list; AuditLogSchemaMetadata typing makes properties required-but-undefined.
src/audit-logs/interfaces/create-audit-log-schema-options.interface.ts Refactors create-schema interfaces to re-export shared schema types and deprecates CreateAuditLogSchemaResponse in favor of AuditLogSchemaResponse.
src/audit-logs/interfaces/index.ts Exports the new schema and list-schemas option interfaces from the audit-logs barrel.
src/audit-logs/interfaces/list-schemas-options.interface.ts Adds ListSchemasOptions extending PaginationOptions with required action.
src/audit-logs/serializers/create-audit-log-schema.serializer.ts Updates schema deserializer to accept AuditLogSchemaResponse and handle missing actor safely.

Sequence Diagram

sequenceDiagram
  participant C as SDK Consumer
  participant AL as AuditLogs
  participant P as AutoPaginatable
  participant W as WorkOS HTTP client
  participant API as WorkOS API

  C->>AL: listSchemas({action, limit?, after?, order?})
  AL->>AL: endpoint = /audit_logs/actions/{action}/schemas
  AL->>W: GET endpoint (query = paginationOptions)
  W->>API: GET /audit_logs/actions/{action}/schemas
  API-->>W: 200 ListResponse<AuditLogSchemaResponse>
  W-->>AL: response data
  AL->>AL: deserializeAuditLogSchema(schemaResponse)
  AL-->>P: new AutoPaginatable(firstPage, getNextPageFn, options)
  P-->>C: paginated result (data + listMetadata)

  C->>P: nextPage()
  P->>W: GET endpoint (query = {after/before/limit/order})
  W->>API: GET /audit_logs/actions/{action}/schemas
  API-->>W: 200 ListResponse<AuditLogSchemaResponse>
  W-->>P: response data
  P->>P: deserializeAuditLogSchema(...) for each item
  P-->>C: next page
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +88 to +92
async listSchemas(
options: ListSchemasOptions,
): Promise<AutoPaginatable<AuditLogSchema, ListSchemasOptions>> {
const { action, ...paginationOptions } = options;
const endpoint = `/audit_logs/actions/${action}/schemas`;
Copy link
Contributor

Choose a reason for hiding this comment

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

[P2] listSchemas should accept optional options like other list methods

listSchemas(options: ListSchemasOptions) forces callers to pass an object, even ListSchemasOptions is mostly pagination + required action. Most other list-style SDK methods take options?: ... and allow a simpler call-site / future optional expansion. Consider listSchemas(action: string, options?: PaginationOptions) or listSchemas(options: ListSchemasOptions) but make options optional with a runtime check.

(If this is intentional API design, please ignore—just flagging because it differs from the rest of the SDK pattern.)

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!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/audit-logs/audit-logs.ts
Line: 88:92

Comment:
[P2] `listSchemas` should accept optional options like other list methods

`listSchemas(options: ListSchemasOptions)` forces callers to pass an object, even `ListSchemasOptions` is mostly pagination + required `action`. Most other list-style SDK methods take `options?: ...` and allow a simpler call-site / future optional expansion. Consider `listSchemas(action: string, options?: PaginationOptions)` or `listSchemas(options: ListSchemasOptions)` but make `options` optional with a runtime check.

(If this is intentional API design, please ignore—just flagging because it differs from the rest of the SDK pattern.)

<sub>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!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

Choose a reason for hiding this comment

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

@swaroopAkkineniWorkos This isn't a bad suggestion, since it might be a bit easier for devs to use listSchemas(action) if they're using the auto-pagination.

@swaroopAkkineniWorkos swaroopAkkineniWorkos marked this pull request as draft February 2, 2026 18:18
@swaroopAkkineniWorkos swaroopAkkineniWorkos marked this pull request as ready for review February 2, 2026 20:39
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +88 to +92
async listSchemas(
options: ListSchemasOptions,
): Promise<AutoPaginatable<AuditLogSchema, ListSchemasOptions>> {
const { action, ...paginationOptions } = options;
const endpoint = `/audit_logs/actions/${action}/schemas`;
Copy link
Contributor

Choose a reason for hiding this comment

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

@swaroopAkkineniWorkos This isn't a bad suggestion, since it might be a bit easier for devs to use listSchemas(action) if they're using the auto-pagination.

Comment on lines +3 to +16
export type {
AuditLogSchema,
AuditLogSchemaResponse,
AuditLogSchemaMetadata,
AuditLogActorSchema,
AuditLogTargetSchema,
} from './audit-log-schema.interface';

import type {
AuditLogSchemaMetadata,
AuditLogSchemaResponse,
AuditLogActorSchema,
AuditLogTargetSchema,
} from './audit-log-schema.interface';
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this actually isn't required because the barrel file exports these all at the same location whether they're in this file or the audit-log-schema.interface.ts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants