feat!: Port AuditLogs to oagen - #1627
gjtorikian wants to merge 4 commits into
Conversation
…zer test Regenerate AuditLogs with the fixed node emitter and fold in the review findings from #1627: - createEvent regains idempotency: a `requestOptions: PostOptions = {}` param and an auto-generated `workos-node-${uuid}` Idempotency-Key, so a 5xx retry no longer silently duplicates an audit event (the options-object emitter path previously dropped it entirely). - createExport JSDoc no longer documents `options.actors` — the curated AuditLogExportOptions doesn't expose that deprecated field. - Drop the dead `SerializedAuditLogExportOptions` interface (its only consumer, the old serializeAuditLogExportOptions, was removed in the port). - serializers.spec.ts now reconstructs the camelCase domain model from the wire fixture instead of feeding the serializer a snake_case object (which threw `model.occurredAt.toISOString()` on undefined). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Regenerated audit-logs.spec.ts with the node emitter's new idempotency test emission. Adds assertions that createEvent forwards a caller-supplied Idempotency-Key header and auto-generates a `workos-node-` prefixed one when none is given — the coverage the oagen port dropped and that review flagged. The behavior was already correct; this guards it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| organization_id: string; | ||
| range_end: string; | ||
| range_start: string; | ||
| rangeEnd: string; |
There was a problem hiding this comment.
is there a reason to make this string in lieu of date?
There was a problem hiding this comment.
No; this should be corrected in the OpenAPI spec.
| * @throws {NotFoundException} 404 | ||
| * @throws {UnprocessableEntityException} 422 | ||
| */ | ||
| async listActionSchemas( |
There was a problem hiding this comment.
seems like a pretty big breaking change to change the name from listSchemas -> ListActionSchemas
There was a problem hiding this comment.
I can rename this 👍
| import { AutoPaginatable } from '../common/utils/pagination'; | ||
| import { WorkOS } from '../workos'; | ||
| import { | ||
| CreateAuditLogEventOptions, |
There was a problem hiding this comment.
the new export structure will break some implementations
swaroopThereItIs-workos
left a comment
There was a problem hiding this comment.
a bit worried about the breaeking changes
|
Commenting on this thread as a follow-up to this issue: #1704 The two retention SDK methods added here are currently the only path to |
|
Yes, I can pull those out--will do so. |
The API now takes a `retention_period` enum (`1_MONTH` through `11_MONTHS`, `1_YEAR` through `10_YEARS`) and has deprecated `retention_period_in_days`. The two are mutually exclusive, so the options type is a union — matching the hand-written `RemoveRoleOptions` precedent — and the serializer only emits the key that was provided, since sending the other as `null` would trip the API's exclusivity check. The enum name `UpdateAuditLogsRetentionRetentionPeriod` mirrors what oagen emits for the other SDKs so the Node surface stays consistent when the full port (#1627) is regenerated.
Description
This PR generates the AuditLogs category in the Node SDK from the OpenAPI spec.
Almost every existing method changed its input signature, its output, or both. Callers cannot expect the same input/output format.
As well:
AuditLogExport.createdAt/updatedAtchange:string → DateAuditLogSchema.createdAtalso changedstring → DateThe following new methods were added:
getOrganizationAuditLogsRetention(options)updateOrganizationAuditLogsRetention(options)listActions(options?)Because of these changes, this is a major breaking change to the SDK.