Skip to content

Commit

Permalink
feat: Add unknown_issue_with_connected_account warning (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
seambot authored Dec 20, 2024
1 parent dea6026 commit 4a420db
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/lib/seam/connect/models/acs/acs-credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const being_deleted = common_acs_credential_warning
})
.describe('Indicates that this credential is being deleted.')

const unknown_issue_with_credential = common_acs_credential_warning
export const unknown_issue_with_credential = common_acs_credential_warning
.extend({
warning_code: z
.literal('unknown_issue_with_credential')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const common_connected_account_error = z.object({
is_connected_account_error: z.literal(true),
})

const warning_code_description =
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.'

const common_connected_account_warning = z.object({
message: z.string(),
})
Expand All @@ -17,9 +20,26 @@ export const connected_account_error = common_connected_account_error.extend({

export type ConnectedAccountError = z.infer<typeof connected_account_error>

const connected_account_warning = common_connected_account_warning.extend({
warning_code: z.string(),
})
export const unknown_issue_with_connected_account =
common_connected_account_warning
.extend({
warning_code: z
.literal('unknown_issue_with_connected_account')
.describe(warning_code_description),
})
.describe(
'An unknown issue occurred while syncing the state of this connected account with the provider. ' +
'This issue may affect the proper functioning of one or more resources in this account.',
)

const connected_account_warning = z
.union([
common_connected_account_warning.extend({
warning_code: z.string(),
}),
unknown_issue_with_connected_account,
])
.describe('Warning associated with the `connected_account`.')

export type ConnectedAccountWarning = z.infer<typeof connected_account_warning>

Expand Down
32 changes: 26 additions & 6 deletions src/lib/seam/connect/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4220,12 +4220,32 @@ export default {
},
warnings: {
items: {
properties: {
message: { type: 'string' },
warning_code: { type: 'string' },
},
required: ['message', 'warning_code'],
type: 'object',
description: 'Warning associated with the `connected_account`.',
oneOf: [
{
properties: {
message: { type: 'string' },
warning_code: { type: 'string' },
},
required: ['message', 'warning_code'],
type: 'object',
},
{
description:
'An unknown issue occurred while syncing the state of this connected account with the provider. This issue may affect the proper functioning of one or more resources in this account.',
properties: {
message: { type: 'string' },
warning_code: {
description:
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
enum: ['unknown_issue_with_connected_account'],
type: 'string',
},
},
required: ['message', 'warning_code'],
type: 'object',
},
],
},
type: 'array',
},
Expand Down
45 changes: 33 additions & 12 deletions src/lib/seam/connect/route-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12294,10 +12294,17 @@ export interface Routes {
is_connected_account_error: true
error_code: string
}>
warnings: Array<{
message: string
warning_code: string
}>
warnings: Array<
| {
message: string
warning_code: string
}
| {
message: string
/** Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */
warning_code: 'unknown_issue_with_connected_account'
}
>
custom_metadata: Record<string, string | boolean>
automatically_manage_new_devices: boolean
}
Expand Down Expand Up @@ -12335,10 +12342,17 @@ export interface Routes {
is_connected_account_error: true
error_code: string
}>
warnings: Array<{
message: string
warning_code: string
}>
warnings: Array<
| {
message: string
warning_code: string
}
| {
message: string
/** Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */
warning_code: 'unknown_issue_with_connected_account'
}
>
custom_metadata: Record<string, string | boolean>
automatically_manage_new_devices: boolean
}>
Expand Down Expand Up @@ -12375,10 +12389,17 @@ export interface Routes {
is_connected_account_error: true
error_code: string
}>
warnings: Array<{
message: string
warning_code: string
}>
warnings: Array<
| {
message: string
warning_code: string
}
| {
message: string
/** Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */
warning_code: 'unknown_issue_with_connected_account'
}
>
custom_metadata: Record<string, string | boolean>
automatically_manage_new_devices: boolean
}
Expand Down

0 comments on commit 4a420db

Please sign in to comment.