Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Circular dependencies #1473

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- [#1462](https://github.com/okta/okta-auth-js/pull/1462) Fixes ESM build for Node.js
- [#1472](https://github.com/okta/okta-auth-js/pull/1472) Added missing remediator `ReEnrollAuthenticatorWarning`
- [#1473](https://github.com/okta/okta-auth-js/pull/1473) Resolves circular dependencies issue for ESM build

### Other

Expand Down
29 changes: 12 additions & 17 deletions lib/myaccount/emailApi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { sendRequest } from './request';
import {
IAPIFunction,
import { IAPIFunction } from './types';
import {
BaseTransaction,
EmailTransaction,
EmailChallengeTransaction
} from './types';
} from './transactions';

/**
* @scope: okta.myAccount.email.read
Expand All @@ -13,12 +13,11 @@ export const getEmails: IAPIFunction<EmailTransaction[]> = async (
oktaAuth,
options?
) => {
const transaction = await sendRequest(oktaAuth, {
const transaction = await sendRequest<EmailTransaction, 'plural'>(oktaAuth, {
url: '/idp/myaccount/emails',
method: 'GET',
accessToken: options?.accessToken,
transactionClassName: 'EmailTransaction'
}) as EmailTransaction[];
accessToken: options?.accessToken
}, EmailTransaction);
return transaction;
};

Expand All @@ -34,8 +33,7 @@ export const getEmail: IAPIFunction<EmailTransaction> = async (
url: `/idp/myaccount/emails/${id}`,
method: 'GET',
accessToken,
transactionClassName: 'EmailTransaction'
}) as EmailTransaction;
}, EmailTransaction);
return transaction;
};

Expand All @@ -52,8 +50,7 @@ export const addEmail: IAPIFunction<EmailTransaction> = async (
method: 'POST',
payload,
accessToken,
transactionClassName: 'EmailTransaction'
}) as EmailTransaction;
}, EmailTransaction);
return transaction;
};

Expand All @@ -69,7 +66,7 @@ export const deleteEmail: IAPIFunction<BaseTransaction> = async (
url: `/idp/myaccount/emails/${id}`,
method: 'DELETE',
accessToken
}) as BaseTransaction;
});
return transaction;
};

Expand All @@ -85,8 +82,7 @@ export const sendEmailChallenge: IAPIFunction<EmailChallengeTransaction> = async
url: `/idp/myaccount/emails/${id}/challenge`,
method: 'POST',
accessToken,
transactionClassName: 'EmailChallengeTransaction'
}) as EmailChallengeTransaction;
}, EmailChallengeTransaction);
return transaction;
};

Expand All @@ -102,8 +98,7 @@ export const getEmailChallenge: IAPIFunction<EmailChallengeTransaction> = async
url: `/idp/myaccount/emails/${emailId}/challenge/${challengeId}`,
method: 'POST',
accessToken,
transactionClassName: 'EmailChallengeTransaction'
}) as EmailChallengeTransaction;
}, EmailChallengeTransaction);
return transaction;
};

Expand All @@ -120,6 +115,6 @@ export const verifyEmailChallenge: IAPIFunction<BaseTransaction> = async (
method: 'POST',
payload,
accessToken
}) as BaseTransaction;
});
return transaction;
};
17 changes: 7 additions & 10 deletions lib/myaccount/passwordApi.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { sendRequest } from './request';
import {
IAPIFunction,
import { IAPIFunction } from './types';
import {
BaseTransaction,
PasswordTransaction
} from './types';
} from './transactions';

/**
* @scope: okta.myAccount.password.read
Expand All @@ -16,8 +16,7 @@ export const getPassword: IAPIFunction<PasswordTransaction> = async (
url: `/idp/myaccount/password`,
method: 'GET',
accessToken: options?.accessToken,
transactionClassName: 'PasswordTransaction'
}) as PasswordTransaction;
}, PasswordTransaction);
return transaction;
};

Expand All @@ -34,8 +33,7 @@ export const enrollPassword: IAPIFunction<PasswordTransaction> = async (
method: 'POST',
payload,
accessToken,
transactionClassName: 'PasswordTransaction'
}) as PasswordTransaction;
}, PasswordTransaction);
return transaction;
};

Expand All @@ -52,8 +50,7 @@ export const updatePassword: IAPIFunction<PasswordTransaction> = async (
method: 'PUT',
payload,
accessToken,
transactionClassName: 'PasswordTransaction'
}) as PasswordTransaction;
}, PasswordTransaction);
return transaction;
};

Expand All @@ -68,6 +65,6 @@ export const deletePassword: IAPIFunction<BaseTransaction> = async (
url: `/idp/myaccount/password`,
method: 'DELETE',
accessToken: options?.accessToken,
}) as BaseTransaction;
});
return transaction;
};
23 changes: 10 additions & 13 deletions lib/myaccount/phoneApi.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { sendRequest } from './request';
import {
IAPIFunction,
import { IAPIFunction } from './types';
import {
BaseTransaction,
PhoneTransaction
} from './types';
} from './transactions';

/**
* @scope: okta.myAccount.phone.read
Expand All @@ -12,12 +12,11 @@ export const getPhones: IAPIFunction<PhoneTransaction[]> = async (
oktaAuth,
options?
) => {
const transaction = await sendRequest(oktaAuth, {
const transaction = await sendRequest<PhoneTransaction, 'plural'>(oktaAuth, {
url: '/idp/myaccount/phones',
method: 'GET',
accessToken: options?.accessToken,
transactionClassName: 'PhoneTransaction'
}) as PhoneTransaction[];
}, PhoneTransaction);
return transaction;
};

Expand All @@ -33,8 +32,7 @@ export const getPhone: IAPIFunction<PhoneTransaction> = async (
url: `/idp/myaccount/phones/${id}`,
method: 'GET',
accessToken,
transactionClassName: 'PhoneTransaction'
}) as PhoneTransaction;
}, PhoneTransaction);
return transaction;
};

Expand All @@ -51,8 +49,7 @@ export const addPhone: IAPIFunction<PhoneTransaction> = async (
method: 'POST',
payload,
accessToken,
transactionClassName: 'PhoneTransaction'
}) as PhoneTransaction;
}, PhoneTransaction);
return transaction;
};

Expand All @@ -68,7 +65,7 @@ export const deletePhone: IAPIFunction<BaseTransaction> = async (
url: `/idp/myaccount/phones/${id}`,
method: 'DELETE',
accessToken,
}) as BaseTransaction;
});
return transaction;
};

Expand All @@ -85,7 +82,7 @@ export const sendPhoneChallenge: IAPIFunction<BaseTransaction> = async (
method: 'POST',
payload,
accessToken
}) as BaseTransaction;
});
return transaction;
};

Expand All @@ -102,6 +99,6 @@ export const verifyPhoneChallenge: IAPIFunction<BaseTransaction> = async (
method: 'POST',
payload,
accessToken
}) as BaseTransaction;
});
return transaction;
};
15 changes: 6 additions & 9 deletions lib/myaccount/profileApi.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { sendRequest } from './request';
import {
IAPIFunction,
import { IAPIFunction } from './types';
import {
ProfileTransaction,
ProfileSchemaTransaction
} from './types';
} from './transactions';

/**
* @scope: okta.myAccount.profile.read
Expand All @@ -13,8 +13,7 @@ export const getProfile: IAPIFunction<ProfileTransaction> = async (oktaAuth, opt
url: '/idp/myaccount/profile',
method: 'GET',
accessToken: options?.accessToken,
transactionClassName: 'ProfileTransaction'
}) as ProfileTransaction;
}, ProfileTransaction);
return transaction;
};

Expand All @@ -31,8 +30,7 @@ export const updateProfile: IAPIFunction<ProfileTransaction> = async (
method: 'PUT',
payload,
accessToken,
transactionClassName: 'ProfileTransaction'
}) as ProfileTransaction;
}, ProfileTransaction);
return transaction;
};

Expand All @@ -47,7 +45,6 @@ export const getProfileSchema: IAPIFunction<ProfileSchemaTransaction> = async (
url: '/idp/myaccount/profile/schema',
method: 'GET',
accessToken: options?.accessToken,
transactionClassName: 'ProfileSchemaTransaction'
}) as ProfileSchemaTransaction;
}, ProfileSchemaTransaction);
return transaction;
};
Loading