Skip to content

Commit 5595094

Browse files
committed
Improve the type handling for raw object maps in typescript.
Closes #15
1 parent 6acf5ca commit 5595094

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

src/FusionAuthClient.ts

+45-50
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ import DefaultRESTClientBuilder from "./DefaultRESTClientBuilder";
1919
import IRESTClientBuilder from "./IRESTClientBuilder";
2020
import ClientResponse from "./ClientResponse";
2121

22-
export interface ObjectMap<K extends string | number, T> {
23-
// @ts-ignore
24-
[key: K]: T
25-
}
26-
2722
export class FusionAuthClient {
2823
public clientBuilder: IRESTClientBuilder = new DefaultRESTClientBuilder();
2924
public credentials: RequestCredentials;
@@ -3471,7 +3466,7 @@ export interface Application {
34713466
active?: boolean;
34723467
authenticationTokenConfiguration?: AuthenticationTokenConfiguration;
34733468
cleanSpeakConfiguration?: CleanSpeakConfiguration;
3474-
data?: ObjectMap<string, any>;
3469+
data?: Record<string, any>;
34753470
id?: UUID;
34763471
jwtConfiguration?: JWTConfiguration;
34773472
lambdaConfiguration?: LambdaConfiguration;
@@ -3557,7 +3552,7 @@ export interface Attachment {
35573552
* @author Brian Pontarelli
35583553
*/
35593554
export interface AuditLog {
3560-
data?: ObjectMap<string, any>;
3555+
data?: Record<string, any>;
35613556
id?: number;
35623557
insertInstant?: number;
35633558
insertUser?: string;
@@ -3645,8 +3640,8 @@ export interface BaseExportRequest {
36453640

36463641
// Do not require a setter for 'type', it is defined by the concrete class and is not mutable
36473642
export interface BaseIdentityProvider<D extends BaseIdentityProviderApplicationConfiguration> extends Enableable {
3648-
applicationConfiguration?: ObjectMap<UUID, D>;
3649-
data?: ObjectMap<string, any>;
3643+
applicationConfiguration?: Record<UUID, D>;
3644+
data?: Record<string, any>;
36503645
debug?: boolean;
36513646
id?: UUID;
36523647
name?: string;
@@ -3658,7 +3653,7 @@ export interface BaseIdentityProvider<D extends BaseIdentityProviderApplicationC
36583653
*/
36593654
export interface BaseIdentityProviderApplicationConfiguration extends Enableable {
36603655
createRegistration?: boolean;
3661-
data?: ObjectMap<string, any>;
3656+
data?: Record<string, any>;
36623657
}
36633658

36643659
/**
@@ -3753,7 +3748,7 @@ export interface ChangePasswordRequest {
37533748
*/
37543749
export interface ChangePasswordResponse {
37553750
oneTimePassword?: string;
3756-
state?: ObjectMap<string, any>;
3751+
state?: Record<string, any>;
37573752
}
37583753

37593754
/**
@@ -3782,7 +3777,7 @@ export enum ClientAuthenticationMethod {
37823777
export interface Consent {
37833778
consentEmailTemplateId?: UUID;
37843779
countryMinimumAgeForSelfConsent?: LocalizedIntegers;
3785-
data?: ObjectMap<string, any>;
3780+
data?: Record<string, any>;
37863781
defaultMinimumAgeForSelfConsent?: number;
37873782
emailPlus?: EmailPlus;
37883783
id?: UUID;
@@ -3992,8 +3987,8 @@ export interface EmailTemplate {
39923987
}
39933988

39943989
export interface EmailTemplateErrors {
3995-
parseErrors?: ObjectMap<string, string>;
3996-
renderErrors?: ObjectMap<string, string>;
3990+
parseErrors?: Record<string, string>;
3991+
renderErrors?: Record<string, string>;
39973992
}
39983993

39993994
/**
@@ -4040,15 +4035,15 @@ export interface Error {
40404035
* @author Brian Pontarelli
40414036
*/
40424037
export interface Errors {
4043-
fieldErrors?: ObjectMap<string, Array<Error>>;
4038+
fieldErrors?: Record<string, Array<Error>>;
40444039
generalErrors?: Array<Error>;
40454040
}
40464041

40474042
/**
40484043
* @author Brian Pontarelli
40494044
*/
40504045
export interface EventConfiguration {
4051-
events?: ObjectMap<EventType, EventConfigurationData>;
4046+
events?: Record<EventType, EventConfigurationData>;
40524047
}
40534048

40544049
export interface EventConfigurationData extends Enableable {
@@ -4203,7 +4198,7 @@ export interface ExternalJWTApplicationConfiguration extends BaseIdentityProvide
42034198
* @author Daniel DeGroff and Brian Pontarelli
42044199
*/
42054200
export interface ExternalJWTIdentityProvider extends BaseIdentityProvider<ExternalJWTApplicationConfiguration> {
4206-
claimMap?: ObjectMap<string, string>;
4201+
claimMap?: Record<string, string>;
42074202
defaultKeyId?: UUID;
42084203
domains?: Array<string>;
42094204
headerKeyParameter?: string;
@@ -4288,7 +4283,7 @@ export interface FamilyEmailRequest {
42884283
* @author Brian Pontarelli
42894284
*/
42904285
export interface FamilyMember {
4291-
data?: ObjectMap<string, any>;
4286+
data?: Record<string, any>;
42924287
insertInstant?: number;
42934288
owner?: boolean;
42944289
role?: FamilyRole;
@@ -4330,7 +4325,7 @@ export interface ForgotPasswordRequest {
43304325
email?: string;
43314326
loginId?: string;
43324327
sendForgotPasswordEmail?: boolean;
4333-
state?: ObjectMap<string, any>;
4328+
state?: Record<string, any>;
43344329
username?: string;
43354330
}
43364331

@@ -4388,10 +4383,10 @@ export enum GrantType {
43884383
* @author Tyler Scott
43894384
*/
43904385
export interface Group {
4391-
data?: ObjectMap<string, any>;
4386+
data?: Record<string, any>;
43924387
id?: UUID;
43934388
name?: string;
4394-
roles?: ObjectMap<UUID, Array<ApplicationRole>>;
4389+
roles?: Record<UUID, Array<ApplicationRole>>;
43954390
tenantId?: UUID;
43964391
}
43974392

@@ -4401,7 +4396,7 @@ export interface Group {
44014396
* @author Daniel DeGroff
44024397
*/
44034398
export interface GroupMember {
4404-
data?: ObjectMap<string, any>;
4399+
data?: Record<string, any>;
44054400
groupId?: UUID;
44064401
id?: UUID;
44074402
insertInstant?: number;
@@ -4440,7 +4435,7 @@ export interface HistoryItem {
44404435
*
44414436
* @author Brian Pontarelli
44424437
*/
4443-
export interface HTTPHeaders extends ObjectMap<string, string> {
4438+
export interface HTTPHeaders extends Record<string, string> {
44444439
}
44454440

44464441
/**
@@ -4485,7 +4480,7 @@ export interface IdentityProviderDetails {
44854480
* @author Brian Pontarelli
44864481
*/
44874482
export interface IdentityProviderLoginRequest extends BaseLoginRequest {
4488-
data?: ObjectMap<string, string>;
4483+
data?: Record<string, string>;
44894484
encodedJWT?: string;
44904485
identityProviderId?: UUID;
44914486
}
@@ -4525,7 +4520,7 @@ export interface IdentityProviderResponse {
45254520
export interface IdentityProviderStartLoginRequest extends BaseLoginRequest {
45264521
identityProviderId?: UUID;
45274522
loginId?: string;
4528-
state?: ObjectMap<string, any>;
4523+
state?: Record<string, any>;
45294524
}
45304525

45314526
/**
@@ -4612,7 +4607,7 @@ export interface IntervalUser {
46124607
/**
46134608
* @author Daniel DeGroff
46144609
*/
4615-
export interface IntrospectResponse extends ObjectMap<string, any> {
4610+
export interface IntrospectResponse extends Record<string, any> {
46164611
}
46174612

46184613
/**
@@ -4723,7 +4718,7 @@ export interface JWTRefreshEvent extends BaseEvent {
47234718
*/
47244719
export interface JWTRefreshTokenRevokeEvent extends BaseEvent {
47254720
applicationId?: UUID;
4726-
applicationTimeToLiveInSeconds?: ObjectMap<UUID, number>;
4721+
applicationTimeToLiveInSeconds?: Record<UUID, number>;
47274722
user?: User;
47284723
userId?: UUID;
47294724
}
@@ -4733,7 +4728,7 @@ export interface JWTRefreshTokenRevokeEvent extends BaseEvent {
47334728
*/
47344729
export interface KafkaConfiguration extends Enableable {
47354730
defaultTopic?: string;
4736-
producer?: ObjectMap<string, string>;
4731+
producer?: Record<string, string>;
47374732
}
47384733

47394734
/**
@@ -4856,15 +4851,15 @@ export enum LambdaType {
48564851
*
48574852
* @author Daniel DeGroff
48584853
*/
4859-
export interface LocalizedIntegers extends ObjectMap<string, number> {
4854+
export interface LocalizedIntegers extends Record<string, number> {
48604855
}
48614856

48624857
/**
48634858
* Models a set of localized Strings that can be stored as JSON.
48644859
*
48654860
* @author Brian Pontarelli
48664861
*/
4867-
export interface LocalizedStrings extends ObjectMap<string, string> {
4862+
export interface LocalizedStrings extends Record<string, string> {
48684863
}
48694864

48704865
/**
@@ -4974,7 +4969,7 @@ export interface LoginResponse {
49744969
changePasswordId?: string;
49754970
changePasswordReason?: ChangePasswordReason;
49764971
refreshToken?: string;
4977-
state?: ObjectMap<string, any>;
4972+
state?: Record<string, any>;
49784973
token?: string;
49794974
twoFactorId?: string;
49804975
twoFactorTrustId?: string;
@@ -5010,7 +5005,7 @@ export interface MaximumPasswordAge extends Enableable {
50105005
*/
50115006
export interface MemberDeleteRequest {
50125007
memberIds?: Array<UUID>;
5013-
members?: ObjectMap<UUID, Array<UUID>>;
5008+
members?: Record<UUID, Array<UUID>>;
50145009
}
50155010

50165011
/**
@@ -5019,7 +5014,7 @@ export interface MemberDeleteRequest {
50195014
* @author Daniel DeGroff
50205015
*/
50215016
export interface MemberRequest {
5022-
members?: ObjectMap<UUID, Array<GroupMember>>;
5017+
members?: Record<UUID, Array<GroupMember>>;
50235018
}
50245019

50255020
/**
@@ -5028,7 +5023,7 @@ export interface MemberRequest {
50285023
* @author Daniel DeGroff
50295024
*/
50305025
export interface MemberResponse {
5031-
members?: ObjectMap<UUID, Array<GroupMember>>;
5026+
members?: Record<UUID, Array<GroupMember>>;
50325027
}
50335028

50345029
export interface MetaData {
@@ -5261,7 +5256,7 @@ export interface PasswordlessSendRequest {
52615256
applicationId?: UUID;
52625257
code?: string;
52635258
loginId?: string;
5264-
state?: ObjectMap<string, any>;
5259+
state?: Record<string, any>;
52655260
}
52665261

52675262
/**
@@ -5270,7 +5265,7 @@ export interface PasswordlessSendRequest {
52705265
export interface PasswordlessStartRequest {
52715266
applicationId?: UUID;
52725267
loginId?: string;
5273-
state?: ObjectMap<string, any>;
5268+
state?: Record<string, any>;
52745269
}
52755270

52765271
/**
@@ -5331,7 +5326,7 @@ export interface PreviewResponse {
53315326
*/
53325327
export interface PublicKeyResponse {
53335328
publicKey?: string;
5334-
publicKeys?: ObjectMap<string, string>;
5329+
publicKeys?: Record<string, string>;
53355330
}
53365331

53375332
/**
@@ -5568,15 +5563,15 @@ export interface SecureIdentity {
55685563
export interface SendRequest {
55695564
bccAddresses?: Array<string>;
55705565
ccAddresses?: Array<string>;
5571-
requestData?: ObjectMap<string, any>;
5566+
requestData?: Record<string, any>;
55725567
userIds?: Array<UUID>;
55735568
}
55745569

55755570
/**
55765571
* @author Daniel DeGroff
55775572
*/
55785573
export interface SendResponse {
5579-
results?: ObjectMap<UUID, EmailTemplateErrors>;
5574+
results?: Record<UUID, EmailTemplateErrors>;
55805575
}
55815576

55825577
/**
@@ -5604,7 +5599,7 @@ export interface SystemConfiguration {
56045599
cookieEncryptionIV?: string;
56055600
cookieEncryptionKey?: string;
56065601
corsConfiguration?: CORSConfiguration;
5607-
data?: ObjectMap<string, any>;
5602+
data?: Record<string, any>;
56085603
eventLogConfiguration?: EventLogConfiguration;
56095604
loginRecordConfiguration?: LoginRecordConfiguration;
56105605
reportTimezone?: string;
@@ -5667,7 +5662,7 @@ export interface Templates {
56675662
*/
56685663
export interface Tenant {
56695664
configured?: boolean;
5670-
data?: ObjectMap<string, any>;
5665+
data?: Record<string, any>;
56715666
emailConfiguration?: EmailConfiguration;
56725667
eventConfiguration?: EventConfiguration;
56735668
externalIdentifierConfiguration?: ExternalIdentifierConfiguration;
@@ -5729,7 +5724,7 @@ export interface TestEvent extends BaseEvent {
57295724
* @author Trevor Smith
57305725
*/
57315726
export interface Theme {
5732-
data?: ObjectMap<string, any>;
5727+
data?: Record<string, any>;
57335728
defaultMessages?: string;
57345729
id?: UUID;
57355730
insertInstant?: number;
@@ -5797,7 +5792,7 @@ export interface Totals {
57975792
* @author Brian Pontarelli
57985793
*/
57995794
export interface TotalsReportResponse {
5800-
applicationTotals?: ObjectMap<UUID, Totals>;
5795+
applicationTotals?: Record<UUID, Totals>;
58015796
globalRegistrations?: number;
58025797
totalGlobalRegistrations?: number;
58035798
}
@@ -5900,7 +5895,7 @@ export interface User extends SecureIdentity {
59005895
active?: boolean;
59015896
birthDate?: string;
59025897
cleanSpeakId?: UUID;
5903-
data?: ObjectMap<string, any>;
5898+
data?: Record<string, any>;
59045899
email?: string;
59055900
expiry?: number;
59065901
firstName?: string;
@@ -6120,7 +6115,7 @@ export interface UserCommentResponse {
61206115
export interface UserConsent {
61216116
consent?: Consent;
61226117
consentId?: UUID;
6123-
data?: ObjectMap<string, any>;
6118+
data?: Record<string, any>;
61246119
giverUserId?: UUID;
61256120
id?: UUID;
61266121
insertInstant?: number;
@@ -6214,7 +6209,7 @@ export interface UserEmailVerifiedEvent extends BaseEvent {
62146209
/**
62156210
* @author Daniel DeGroff
62166211
*/
6217-
export interface UserinfoResponse extends ObjectMap<string, any> {
6212+
export interface UserinfoResponse extends Record<string, any> {
62186213
}
62196214

62206215
/**
@@ -6272,14 +6267,14 @@ export interface UserRegistration {
62726267
applicationId?: UUID;
62736268
authenticationToken?: string;
62746269
cleanSpeakId?: UUID;
6275-
data?: ObjectMap<string, any>;
6270+
data?: Record<string, any>;
62766271
id?: UUID;
62776272
insertInstant?: number;
62786273
lastLoginInstant?: number;
62796274
preferredLanguages?: Array<string>;
62806275
roles?: Array<string>;
62816276
timezone?: string;
6282-
tokens?: ObjectMap<string, string>;
6277+
tokens?: Record<string, string>;
62836278
username?: string;
62846279
usernameStatus?: ContentStatus;
62856280
verified?: boolean;
@@ -6410,9 +6405,9 @@ export interface VerifyRegistrationResponse {
64106405
export interface Webhook {
64116406
applicationIds?: Array<UUID>;
64126407
connectTimeout?: number;
6413-
data?: ObjectMap<string, any>;
6408+
data?: Record<string, any>;
64146409
description?: string;
6415-
eventsEnabled?: ObjectMap<EventType, boolean>;
6410+
eventsEnabled?: Record<EventType, boolean>;
64166411
global?: boolean;
64176412
headers?: HTTPHeaders;
64186413
httpAuthenticationPassword?: string;

0 commit comments

Comments
 (0)