最新の型の追加

This commit is contained in:
kakkokari-gtyih 2024-10-16 18:32:39 +09:00
parent 41736196a9
commit d56b336349
2 changed files with 34 additions and 3 deletions

View File

@ -1,13 +1,15 @@
import { Endpoints as Gen } from './autogen/endpoint.js';
import { UserDetailed } from './autogen/models.js';
import { AdminRolesCreateRequest, AdminRolesCreateResponse, UsersShowRequest, UsersShowErrors } from './autogen/entities.js';
import { AdminRolesCreateRequest, AdminRolesCreateResponse, UsersShowRequest, UsersShowErrors, AdminRolesCreateErrors } from './autogen/entities.js';
import {
PartialRolePolicyOverride,
SigninFlowRequest,
SigninFlowResponse,
SigninFlowErrors,
SigninWithPasskeyInitResponse,
SigninWithPasskeyRequest,
SigninWithPasskeyResponse,
SigninWithPasskeyErrors,
SignupPendingRequest,
SignupPendingResponse,
SignupRequest,
@ -88,6 +90,7 @@ export type Endpoints = Overwrite<
'signin-flow': {
req: SigninFlowRequest;
res: SigninFlowResponse;
errors: SigninFlowErrors;
},
'signin-with-passkey': {
req: SigninWithPasskeyRequest;
@ -104,10 +107,12 @@ export type Endpoints = Overwrite<
$default: SigninWithPasskeyInitResponse;
},
},
errors: SigninWithPasskeyErrors;
},
'admin/roles/create': {
req: Overwrite<AdminRolesCreateRequest, { policies: PartialRolePolicyOverride }>;
res: AdminRolesCreateResponse;
errors: AdminRolesCreateErrors;
}
}
>

View File

@ -309,7 +309,15 @@ export type SigninFlowResponse = {
authRequest: PublicKeyCredentialRequestOptionsJSON;
};
export type SigninErrors = {
type WebAuthnServiceErrors = {
id: '2d16e51c-007b-4edd-afd2-f7dd02c947f6', // Invalid context (WebAuthnService)
} | {
id: '36b96a7d-b547-412d-aeed-2d611cdc8cdc', // Unknown WebAuthn Key (WebAuthnService)
} | {
id: 'b18c89a7-5b5e-4cec-bb5b-0419f332d430', // Verification failed (WebAuthnService)
};
export type SigninFlowErrors = {
message: 'Too many failed attempts to sign in. Try again later.',
code: 'TOO_MANY_AUTHENTICATION_FAILURES',
id: '22d05606-fbcf-421a-a2db-b32610dcfd1b',
@ -325,7 +333,7 @@ export type SigninErrors = {
id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f', // Invalid one-time password
} | {
id: '93b86c4b-72f9-40eb-9815-798928603d1e', // Invalid passkey credential
};
} | WebAuthnServiceErrors;
export type SigninWithPasskeyRequest = {
credential?: AuthenticationResponseJSON;
@ -341,6 +349,24 @@ export type SigninWithPasskeyResponse = {
signinResponse: SigninFlowResponse & { finished: true };
};
export type SigninWithPasskeyErrors = {
message: 'Too many failed attempts to sign in. Try again later.',
code: 'TOO_MANY_AUTHENTICATION_FAILURES',
id: '22d05606-fbcf-421a-a2db-b32610dcfd1b',
} | {
id: '4e30e80c-e338-45a0-8c8f-44455efa3b76', // Internal server error
} | {
id: '1658cc2e-4495-461f-aee4-d403cdf073c1', // No Context
} | {
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c', // Invalid credentials
} | {
id: '652f899f-66d4-490e-993e-6606c8ec04c3', // User not found
} | {
id: 'e03a5f46-d309-4865-9b69-56282d94e1eb', // User is suspended
} | {
id: '2d84773e-f7b7-4d0b-8f72-bb69b584c912', // Passwordless Login is disabled
} | WebAuthnServiceErrors;
type Values<T extends Record<PropertyKey, unknown>> = T[keyof T];
export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit<Values<Role['policies']>, 'value'> & { value: RolePolicies[k] }}>;