diff options
author | Florian Dold <florian@dold.me> | 2021-11-04 16:25:02 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-11-04 16:53:11 +0100 |
commit | 83622bd65a0ebd7c22555fb2cfdb542e20d044b9 (patch) | |
tree | 18d4e2482552cdd91305788bc9948c5ec8de0cc9 /packages | |
parent | 4ac0b23793417536281f7d3c67c4c954da795f88 (diff) |
anastasis-core: type naming consistency
Diffstat (limited to 'packages')
-rw-r--r-- | packages/anastasis-core/src/index.ts | 50 | ||||
-rw-r--r-- | packages/anastasis-core/src/reducer-types.ts | 30 |
2 files changed, 40 insertions, 40 deletions
diff --git a/packages/anastasis-core/src/index.ts b/packages/anastasis-core/src/index.ts index 3b73aa002..fd04eb4d7 100644 --- a/packages/anastasis-core/src/index.ts +++ b/packages/anastasis-core/src/index.ts @@ -27,15 +27,15 @@ import { TruthUploadRequest, } from "./provider-types.js"; import { - ActionArgAddAuthentication, - ActionArgDeleteAuthentication, - ActionArgDeletePolicy, - ActionArgEnterSecret, - ActionArgEnterSecretName, - ActionArgEnterUserAttributes, + ActionArgsAddAuthentication, + ActionArgsDeleteAuthentication, + ActionArgsDeletePolicy, + ActionArgsEnterSecret, + ActionArgsEnterSecretName, + ActionArgsEnterUserAttributes, ActionArgsAddPolicy, - ActionArgSelectContinent, - ActionArgSelectCountry, + ActionArgsSelectContinent, + ActionArgsSelectCountry, ActionArgsSelectChallenge, ActionArgsSolveChallengeRequest, ActionArgsUpdateExpiration, @@ -43,9 +43,9 @@ import { AuthenticationProviderStatusOk, AuthMethod, BackupStates, - codecForActionArgEnterUserAttributes, + codecForActionArgsEnterUserAttributes, codecForActionArgsAddPolicy, - codecForActionArgSelectChallenge, + codecForActionArgsSelectChallenge, codecForActionArgSelectContinent, codecForActionArgSelectCountry, codecForActionArgsUpdateExpiration, @@ -168,7 +168,7 @@ export async function getRecoveryStartState(): Promise<ReducerStateRecovery> { async function selectCountry( selectedContinent: string, - args: ActionArgSelectCountry, + args: ActionArgsSelectCountry, ): Promise<Partial<ReducerStateBackup> & Partial<ReducerStateRecovery>> { const countryCode = args.country_code; const currencies = args.currencies; @@ -209,7 +209,7 @@ async function selectCountry( async function backupSelectCountry( state: ReducerStateBackup, - args: ActionArgSelectCountry, + args: ActionArgsSelectCountry, ): Promise<ReducerStateError | ReducerStateBackup> { return { ...state, @@ -220,7 +220,7 @@ async function backupSelectCountry( async function recoverySelectCountry( state: ReducerStateRecovery, - args: ActionArgSelectCountry, + args: ActionArgsSelectCountry, ): Promise<ReducerStateError | ReducerStateRecovery> { return { ...state, @@ -275,7 +275,7 @@ async function getProviderInfo( async function backupEnterUserAttributes( state: ReducerStateBackup, - args: ActionArgEnterUserAttributes, + args: ActionArgsEnterUserAttributes, ): Promise<ReducerStateBackup> { const attributes = args.identity_attributes; const providerUrls = Object.keys(state.authentication_providers ?? {}); @@ -787,7 +787,7 @@ async function solveChallenge( async function recoveryEnterUserAttributes( state: ReducerStateRecovery, - args: ActionArgEnterUserAttributes, + args: ActionArgsEnterUserAttributes, ): Promise<ReducerStateRecovery | ReducerStateError> { // FIXME: validate attributes const st: ReducerStateRecovery = { @@ -812,7 +812,7 @@ async function selectChallenge( async function backupSelectContinent( state: ReducerStateBackup, - args: ActionArgSelectContinent, + args: ActionArgsSelectContinent, ): Promise<ReducerStateBackup | ReducerStateError> { const countries = getCountries(args.continent); if (countries.length <= 0) { @@ -831,7 +831,7 @@ async function backupSelectContinent( async function recoverySelectContinent( state: ReducerStateRecovery, - args: ActionArgSelectContinent, + args: ActionArgsSelectContinent, ): Promise<ReducerStateRecovery | ReducerStateError> { const countries = getCountries(args.continent); return { @@ -890,7 +890,7 @@ function transitionRecoveryJump( async function addAuthentication( state: ReducerStateBackup, - args: ActionArgAddAuthentication, + args: ActionArgsAddAuthentication, ): Promise<ReducerStateBackup> { return { ...state, @@ -903,7 +903,7 @@ async function addAuthentication( async function deleteAuthentication( state: ReducerStateBackup, - args: ActionArgDeleteAuthentication, + args: ActionArgsDeleteAuthentication, ): Promise<ReducerStateBackup> { const m = state.authentication_methods ?? []; m.splice(args.authentication_method, 1); @@ -915,7 +915,7 @@ async function deleteAuthentication( async function deletePolicy( state: ReducerStateBackup, - args: ActionArgDeletePolicy, + args: ActionArgsDeletePolicy, ): Promise<ReducerStateBackup> { const policies = [...(state.policies ?? [])]; policies.splice(args.policy_index, 1); @@ -1020,7 +1020,7 @@ async function updateUploadFees( async function enterSecret( state: ReducerStateBackup, - args: ActionArgEnterSecret, + args: ActionArgsEnterSecret, ): Promise<ReducerStateBackup | ReducerStateError> { return updateUploadFees({ ...state, @@ -1048,7 +1048,7 @@ async function nextFromChallengeSelecting( async function enterSecretName( state: ReducerStateBackup, - args: ActionArgEnterSecretName, + args: ActionArgsEnterSecretName, ): Promise<ReducerStateBackup | ReducerStateError> { return { ...state, @@ -1094,7 +1094,7 @@ const backupTransitions: Record< ...transitionBackupJump("back", BackupStates.CountrySelecting), ...transition( "enter_user_attributes", - codecForActionArgEnterUserAttributes(), + codecForActionArgsEnterUserAttributes(), backupEnterUserAttributes, ), }, @@ -1157,7 +1157,7 @@ const recoveryTransitions: Record< ...transitionRecoveryJump("back", RecoveryStates.CountrySelecting), ...transition( "enter_user_attributes", - codecForActionArgEnterUserAttributes(), + codecForActionArgsEnterUserAttributes(), recoveryEnterUserAttributes, ), }, @@ -1169,7 +1169,7 @@ const recoveryTransitions: Record< ...transitionRecoveryJump("back", RecoveryStates.SecretSelecting), ...transition( "select_challenge", - codecForActionArgSelectChallenge(), + codecForActionArgsSelectChallenge(), selectChallenge, ), ...transition("next", codecForAny(), nextFromChallengeSelecting), diff --git a/packages/anastasis-core/src/reducer-types.ts b/packages/anastasis-core/src/reducer-types.ts index 69feb6b64..e0d311e88 100644 --- a/packages/anastasis-core/src/reducer-types.ts +++ b/packages/anastasis-core/src/reducer-types.ts @@ -256,16 +256,16 @@ export interface ReducerStateBackupUserAttributesCollecting authentication_providers: { [url: string]: AuthenticationProviderStatus }; } -export interface ActionArgEnterUserAttributes { +export interface ActionArgsEnterUserAttributes { identity_attributes: Record<string, string>; } -export const codecForActionArgEnterUserAttributes = () => - buildCodecForObject<ActionArgEnterUserAttributes>() +export const codecForActionArgsEnterUserAttributes = () => + buildCodecForObject<ActionArgsEnterUserAttributes>() .property("identity_attributes", codecForAny()) - .build("ActionArgEnterUserAttributes"); + .build("ActionArgsEnterUserAttributes"); -export interface ActionArgAddAuthentication { +export interface ActionArgsAddAuthentication { authentication_method: { type: string; instructions: string; @@ -274,19 +274,19 @@ export interface ActionArgAddAuthentication { }; } -export interface ActionArgDeleteAuthentication { +export interface ActionArgsDeleteAuthentication { authentication_method: number; } -export interface ActionArgDeletePolicy { +export interface ActionArgsDeletePolicy { policy_index: number; } -export interface ActionArgEnterSecretName { +export interface ActionArgsEnterSecretName { name: string; } -export interface ActionArgEnterSecret { +export interface ActionArgsEnterSecret { secret: { value: string; mime?: string; @@ -294,16 +294,16 @@ export interface ActionArgEnterSecret { expiration: Timestamp; } -export interface ActionArgSelectContinent { +export interface ActionArgsSelectContinent { continent: string; } export const codecForActionArgSelectContinent = () => - buildCodecForObject<ActionArgSelectContinent>() + buildCodecForObject<ActionArgsSelectContinent>() .property("continent", codecForString()) .build("ActionArgSelectContinent"); -export interface ActionArgSelectCountry { +export interface ActionArgsSelectCountry { country_code: string; currencies: string[]; } @@ -347,13 +347,13 @@ export const codecForActionArgsUpdateExpiration = () => .property("expiration", codecForTimestamp) .build("ActionArgsUpdateExpiration"); -export const codecForActionArgSelectChallenge = () => +export const codecForActionArgsSelectChallenge = () => buildCodecForObject<ActionArgsSelectChallenge>() .property("uuid", codecForString()) - .build("ActionArgSelectChallenge"); + .build("ActionArgsSelectChallenge"); export const codecForActionArgSelectCountry = () => - buildCodecForObject<ActionArgSelectCountry>() + buildCodecForObject<ActionArgsSelectCountry>() .property("country_code", codecForString()) .property("currencies", codecForList(codecForString())) .build("ActionArgSelectCountry"); |