From 0cd46475658548ae554527d0829538898a33550d Mon Sep 17 00:00:00 2001 From: Vatsal Parikh Date: Tue, 9 Jun 2026 10:09:41 -0700 Subject: [PATCH] fix(ping-sdk): fix import order for all files in ping sdk --- e2e/davinci-app/components/boolean.ts | 5 +- e2e/davinci-app/components/fido.ts | 5 +- e2e/davinci-app/components/label.ts | 3 +- e2e/davinci-app/components/password.ts | 5 +- e2e/davinci-app/components/polling.ts | 2 +- e2e/davinci-app/components/protect.ts | 2 +- .../components/social-login-button.ts | 2 +- e2e/davinci-app/components/text.ts | 5 +- e2e/davinci-app/main.ts | 44 +++++++-------- .../src/device-binding/main.ts | 3 +- .../src/device-profile/main.ts | 3 +- e2e/device-client-app/src/oath/main.ts | 3 +- e2e/device-client-app/src/push/main.ts | 3 +- e2e/device-client-app/src/types.ts | 2 +- e2e/device-client-app/src/utils/index.ts | 13 +++-- e2e/device-client-app/src/webauthn/main.ts | 3 +- e2e/device-client-app/vite.config.ts | 2 +- e2e/journey-app/callback-map.ts | 48 ++++++++--------- e2e/journey-app/components/device-profile.ts | 1 + .../components/ping-protect-evaluation.ts | 3 +- .../components/ping-protect-initialize.ts | 1 + e2e/journey-app/components/qr-code.ts | 3 +- e2e/journey-app/components/recovery-codes.ts | 3 +- e2e/journey-app/components/webauthn-step.ts | 3 +- e2e/journey-app/main.ts | 9 ++-- e2e/journey-app/package.json | 4 +- .../services/delete-webauthn-device.ts | 3 +- .../src/handlers/authorize.handler.ts | 5 +- .../src/handlers/capabilities.handler.ts | 7 +-- .../src/handlers/end-session.handler.ts | 5 +- .../src/handlers/healthcheck.handler.ts | 3 +- .../handlers/open-id-configuration.handler.ts | 5 +- .../src/handlers/revoke.handler.ts | 5 +- e2e/mock-api-v2/src/handlers/token.handler.ts | 5 +- .../src/handlers/userinfo.handler.ts | 7 +-- e2e/mock-api-v2/src/helpers/match.ts | 8 +-- e2e/mock-api-v2/src/main.ts | 25 ++++----- .../src/middleware/Authorization.ts | 2 +- e2e/mock-api-v2/src/middleware/Session.ts | 5 +- e2e/mock-api-v2/src/responses/index.ts | 4 +- .../src/services/mock-env-helpers/index.ts | 15 +++--- .../src/services/tokens.service.ts | 13 +++-- .../src/services/userinfo.service.ts | 11 ++-- e2e/mock-api-v2/src/spec.ts | 26 ++++----- e2e/mock-api-v2/src/types/index.ts | 10 ++-- e2e/oidc-app/src/utils/oidc-app.ts | 1 + e2e/oidc-app/vite.config.ts | 2 +- e2e/protect-app/src/protect-native.ts | 16 +++--- eslint.config.mjs | 33 ++++++++++++ package.json | 1 + .../api-report/davinci-client.api.md | 2 +- .../api-report/davinci-client.types.api.md | 2 +- .../src/lib/client.store.effects.test.ts | 7 +-- .../src/lib/client.store.effects.ts | 14 ++--- .../davinci-client/src/lib/client.store.ts | 51 +++++++++--------- .../src/lib/client.store.utils.ts | 14 ++--- .../src/lib/client.types.test-d.ts | 2 +- .../davinci-client/src/lib/client.types.ts | 12 ++--- .../src/lib/collector.types.test-d.ts | 47 ++++++++-------- .../src/lib/collector.utils.test.ts | 54 ++++++++++--------- .../davinci-client/src/lib/collector.utils.ts | 48 ++++++++--------- .../src/lib/config.slice.test.ts | 3 +- .../davinci-client/src/lib/config.slice.ts | 2 +- .../src/lib/config.types.test-d.ts | 4 +- .../davinci-client/src/lib/davinci.api.ts | 20 ++++--- .../src/lib/davinci.utils.test.ts | 13 +++-- .../davinci-client/src/lib/davinci.utils.ts | 19 ++++--- packages/davinci-client/src/lib/fido/fido.ts | 2 + .../src/lib/fido/fido.utils.test.ts | 5 +- .../src/lib/node.reducer.test.ts | 7 +-- .../davinci-client/src/lib/node.reducer.ts | 29 +++++----- .../davinci-client/src/lib/node.slice.test.ts | 11 ++-- packages/davinci-client/src/lib/node.slice.ts | 11 ++-- .../src/lib/node.types.test-d.ts | 49 ++++++++--------- packages/davinci-client/src/lib/node.types.ts | 40 +++++++------- .../davinci-client/src/lib/node.utils.test.ts | 2 +- packages/davinci-client/src/lib/node.utils.ts | 4 +- .../src/lib/password-policy.rules.ts | 2 +- .../davinci-client/src/lib/wellknown.api.ts | 2 +- packages/davinci-client/src/types.test-d.ts | 19 +++---- packages/davinci-client/src/types.ts | 19 ++++--- .../src/lib/device.store.test.ts | 8 +-- .../src/lib/device.store.test.utils.ts | 6 +-- .../device-client/src/lib/device.store.ts | 16 +++--- .../src/lib/device.store.utils.ts | 4 +- .../src/lib/mock-data/device.store.mock.ts | 4 +- .../device-client/src/lib/services/index.ts | 28 ++++++---- packages/device-client/src/lib/types/index.ts | 2 +- .../src/__tests__/types-reexport.typecheck.ts | 26 ++++----- .../attribute-input-callback.test.ts | 4 +- .../lib/callbacks/attribute-input-callback.ts | 4 +- .../src/lib/callbacks/base-callback.test.ts | 4 +- .../src/lib/callbacks/base-callback.ts | 2 +- .../src/lib/callbacks/choice-callback.test.ts | 6 +-- .../src/lib/callbacks/choice-callback.ts | 4 +- .../callbacks/confirmation-callback.test.ts | 6 +-- .../lib/callbacks/confirmation-callback.ts | 4 +- .../callbacks/device-profile-callback.test.ts | 6 +-- .../lib/callbacks/device-profile-callback.ts | 4 +- .../src/lib/callbacks/factory.test.ts | 11 ++-- .../src/lib/callbacks/factory.ts | 7 ++- .../callbacks/hidden-value-callback.test.ts | 6 +-- .../lib/callbacks/hidden-value-callback.ts | 4 +- .../lib/callbacks/kba-create-callback.test.ts | 6 +-- .../src/lib/callbacks/kba-create-callback.ts | 4 +- .../lib/callbacks/metadata-callback.test.ts | 6 +-- .../src/lib/callbacks/metadata-callback.ts | 4 +- .../src/lib/callbacks/name-callback.test.ts | 6 +-- .../src/lib/callbacks/name-callback.ts | 4 +- .../lib/callbacks/password-callback.test.ts | 6 +-- .../src/lib/callbacks/password-callback.ts | 4 +- .../ping-protect-evaluation-callback.test.ts | 2 +- .../ping-protect-evaluation-callback.ts | 4 +- .../ping-protect-initialize-callback.test.ts | 2 +- .../ping-protect-initialize-callback.ts | 4 +- .../callbacks/polling-wait-callback.test.ts | 6 +-- .../lib/callbacks/polling-wait-callback.ts | 4 +- .../lib/callbacks/recaptcha-callback.test.ts | 6 +-- .../src/lib/callbacks/recaptcha-callback.ts | 4 +- .../recaptcha-enterprise-callback.test.ts | 6 +-- .../recaptcha-enterprise-callback.ts | 4 +- .../lib/callbacks/redirect-callback.test.ts | 6 +-- .../src/lib/callbacks/redirect-callback.ts | 4 +- .../lib/callbacks/select-idp-callback.test.ts | 6 +-- .../src/lib/callbacks/select-idp-callback.ts | 4 +- .../suspended-text-output-callback.test.ts | 6 +-- .../suspended-text-output-callback.ts | 4 +- .../terms-and-conditions-callback.test.ts | 6 +-- .../terms-and-conditions-callback.ts | 4 +- .../lib/callbacks/text-input-callback.test.ts | 4 +- .../src/lib/callbacks/text-input-callback.ts | 4 +- .../callbacks/text-output-callback.test.ts | 6 +-- .../src/lib/callbacks/text-output-callback.ts | 4 +- ...validated-create-password-callback.test.ts | 4 +- .../validated-create-password-callback.ts | 4 +- ...validated-create-username-callback.test.ts | 4 +- .../validated-create-username-callback.ts | 4 +- .../src/lib/client.store.test.ts | 7 +-- .../journey-client/src/lib/client.store.ts | 21 ++++---- .../src/lib/client.store.utils.ts | 5 +- .../src/lib/client.types.test-d.ts | 4 +- .../src/lib/config.slice.test.ts | 4 +- .../journey-client/src/lib/config.slice.ts | 8 ++- .../src/lib/config.types.test-d.ts | 6 ++- .../journey-client/src/lib/config.types.ts | 1 + .../src/lib/device/device-profile.test.ts | 2 +- .../src/lib/device/device-profile.ts | 6 +-- packages/journey-client/src/lib/interfaces.ts | 2 +- .../journey-client/src/lib/journey.api.ts | 12 ++--- .../journey-client/src/lib/journey.utils.ts | 8 +-- .../src/lib/login-failure.utils.ts | 4 +- .../src/lib/login-success.utils.ts | 2 +- .../src/lib/policy/policy.test.ts | 4 +- .../journey-client/src/lib/policy/policy.ts | 4 +- .../src/lib/qr-code/qr-code.test.ts | 4 +- .../journey-client/src/lib/qr-code/qr-code.ts | 5 +- .../lib/recovery-codes/recovery-codes.test.ts | 2 +- packages/journey-client/src/lib/step.test.ts | 8 +-- packages/journey-client/src/lib/step.utils.ts | 5 +- .../src/lib/webauthn/helpers.test.ts | 4 +- .../src/lib/webauthn/helpers.ts | 1 + .../src/lib/webauthn/webauthn.test.ts | 14 ++--- .../src/lib/webauthn/webauthn.ts | 4 +- .../journey-client/src/lib/wellknown.api.ts | 2 +- .../src/lib/wellknown.utils.test.ts | 4 +- .../oidc-client/api-report/oidc-client.api.md | 2 +- .../api-report/oidc-client.types.api.md | 2 +- .../src/__tests__/types-reexport.typecheck.ts | 10 ++-- .../src/lib/authorize.request.micros.test.ts | 15 +++--- .../src/lib/authorize.request.micros.ts | 6 +-- .../oidc-client/src/lib/authorize.request.ts | 5 +- .../src/lib/authorize.request.utils.test.ts | 26 +++++---- .../src/lib/authorize.request.utils.ts | 3 +- .../oidc-client/src/lib/client.store.test.ts | 2 +- packages/oidc-client/src/lib/client.store.ts | 10 ++-- .../oidc-client/src/lib/client.store.utils.ts | 6 +-- packages/oidc-client/src/lib/client.types.ts | 5 +- .../oidc-client/src/lib/exchange.request.ts | 6 +-- .../src/lib/exchange.utils.test.ts | 7 ++- .../oidc-client/src/lib/exchange.utils.ts | 8 +-- .../src/lib/logout.request.test.ts | 14 ++--- .../oidc-client/src/lib/logout.request.ts | 6 ++- packages/oidc-client/src/lib/oidc.api.ts | 20 +++---- .../oidc-client/src/lib/oidc.api.utils.ts | 2 +- packages/oidc-client/src/lib/wellknown.api.ts | 3 +- packages/protect/src/lib/protect.test.ts | 3 +- packages/protect/src/lib/protect.ts | 2 +- .../src/lib/iframe-manager.effects.test.ts | 1 + .../logger/src/lib/logger.effects.ts | 2 +- .../sdk-effects/logger/src/lib/logger.test.ts | 3 +- .../oidc/src/lib/authorize.effects.ts | 2 +- .../oidc/src/lib/authorize.test.ts | 6 ++- .../oidc/src/lib/state-pkce.effects.ts | 2 +- .../oidc/src/lib/state-pkce.test.ts | 4 +- .../oidc/src/lib/wellknown.effects.test.ts | 5 +- .../oidc/src/lib/wellknown.effects.ts | 2 +- .../src/lib/request-mware.effects.ts | 6 +-- .../src/lib/request-mware.test.ts | 8 +-- .../src/lib/request-mware.types.ts | 4 +- .../storage/src/lib/storage.effects.test.ts | 4 +- .../storage/src/lib/storage.effects.ts | 2 +- packages/sdk-types/src/lib/config.types.ts | 2 +- .../sdk-types/src/lib/legacy-config.types.ts | 2 +- .../src/lib/error/error.utils.test.ts | 4 +- .../sdk-utilities/src/lib/oidc/pkce.test.ts | 3 +- .../sdk-utilities/src/lib/url/am-url.test.ts | 3 +- .../src/lib/wellknown/wellknown.utils.test.ts | 5 +- pnpm-lock.yaml | 28 ++++++---- tools/api-report/src/config.spec.ts | 3 +- tools/api-report/src/config.ts | 1 + tools/api-report/src/fixer.spec.ts | 9 ++-- tools/api-report/src/fixer.ts | 4 +- tools/api-report/src/integration.spec.ts | 9 ++-- tools/api-report/src/main.spec.ts | 3 +- tools/api-report/src/main.ts | 7 +-- tools/api-report/src/resolve-entries.spec.ts | 3 +- .../interface-mapping-validator/package.json | 1 - .../src/differ.test.ts | 8 +-- .../interface-mapping-validator/src/differ.ts | 3 +- .../src/extractors/legacy.test.ts | 3 +- .../src/extractors/legacy.ts | 3 +- .../src/extractors/markdown.test.ts | 3 +- .../src/extractors/markdown.ts | 2 + .../src/extractors/new-sdk.test.ts | 3 +- .../src/extractors/new-sdk.ts | 9 ++-- .../src/fixer.test.ts | 6 ++- .../interface-mapping-validator/src/fixer.ts | 3 +- .../src/generator.test.ts | 4 +- .../src/generator.ts | 4 +- .../src/integration.test.ts | 20 +++---- tools/interface-mapping-validator/src/main.ts | 29 +++++----- .../src/reporter.test.ts | 6 ++- .../src/validate-client-imports.spec.ts | 3 +- .../src/writer.test.ts | 5 +- tools/user-scripts/src/index.ts | 1 + tools/user-scripts/src/lib/user-scripts.ts | 3 +- 236 files changed, 1004 insertions(+), 803 deletions(-) diff --git a/e2e/davinci-app/components/boolean.ts b/e2e/davinci-app/components/boolean.ts index d26d792d6b..7601f98bc4 100644 --- a/e2e/davinci-app/components/boolean.ts +++ b/e2e/davinci-app/components/boolean.ts @@ -4,12 +4,13 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +import { dotToCamelCase, richContentInterpolation } from '../helper.js'; + import type { - ValidatedBooleanCollector, Updater, + ValidatedBooleanCollector, Validator, } from '@forgerock/davinci-client/types'; -import { dotToCamelCase, richContentInterpolation } from '../helper.js'; /** * Creates a single checkbox and attaches it to the form diff --git a/e2e/davinci-app/components/fido.ts b/e2e/davinci-app/components/fido.ts index 6c68e1bafc..cacef97c8e 100644 --- a/e2e/davinci-app/components/fido.ts +++ b/e2e/davinci-app/components/fido.ts @@ -5,11 +5,12 @@ * of the MIT license. See the LICENSE file for details. */ import { fido } from '@forgerock/davinci-client'; + import type { - FidoRegistrationCollector, FidoAuthenticationCollector, - Updater, FidoClient, + FidoRegistrationCollector, + Updater, } from '@forgerock/davinci-client/types'; export default function fidoComponent( diff --git a/e2e/davinci-app/components/label.ts b/e2e/davinci-app/components/label.ts index ab20b78678..b317ba1cd2 100644 --- a/e2e/davinci-app/components/label.ts +++ b/e2e/davinci-app/components/label.ts @@ -4,9 +4,10 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { ReadOnlyCollector, RichTextCollector } from '@forgerock/davinci-client/types'; import { richContentInterpolation } from '../helper.js'; +import type { ReadOnlyCollector, RichTextCollector } from '@forgerock/davinci-client/types'; + export default function ( formEl: HTMLFormElement, collector: ReadOnlyCollector | RichTextCollector, diff --git a/e2e/davinci-app/components/password.ts b/e2e/davinci-app/components/password.ts index 869e4d6b1b..769b8ef433 100644 --- a/e2e/davinci-app/components/password.ts +++ b/e2e/davinci-app/components/password.ts @@ -4,13 +4,14 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +import { dotToCamelCase } from '../helper.js'; + import type { PasswordCollector, - ValidatedPasswordCollector, Updater, + ValidatedPasswordCollector, Validator, } from '@forgerock/davinci-client/types'; -import { dotToCamelCase } from '../helper.js'; const UPPERCASE_RE = /^[A-Z]+$/; const LOWERCASE_RE = /^[a-z]+$/; diff --git a/e2e/davinci-app/components/polling.ts b/e2e/davinci-app/components/polling.ts index bb33f247af..25f60ce991 100644 --- a/e2e/davinci-app/components/polling.ts +++ b/e2e/davinci-app/components/polling.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { PollingCollector, Poller, Updater } from '@forgerock/davinci-client/types'; +import type { Poller, PollingCollector, Updater } from '@forgerock/davinci-client/types'; export default function pollingComponent( formEl: HTMLFormElement, diff --git a/e2e/davinci-app/components/protect.ts b/e2e/davinci-app/components/protect.ts index ac2434b6f6..f7e5022f9e 100644 --- a/e2e/davinci-app/components/protect.ts +++ b/e2e/davinci-app/components/protect.ts @@ -6,8 +6,8 @@ */ import type { TextCollector, - ValidatedTextCollector, Updater, + ValidatedTextCollector, } from '@forgerock/davinci-client/types'; export default function protectComponent( diff --git a/e2e/davinci-app/components/social-login-button.ts b/e2e/davinci-app/components/social-login-button.ts index a4f314495e..edcc2ea227 100644 --- a/e2e/davinci-app/components/social-login-button.ts +++ b/e2e/davinci-app/components/social-login-button.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { InternalErrorResponse, IdpCollector } from '@forgerock/davinci-client/types'; +import type { IdpCollector, InternalErrorResponse } from '@forgerock/davinci-client/types'; export default function submitButtonComponent( formEl: HTMLFormElement, diff --git a/e2e/davinci-app/components/text.ts b/e2e/davinci-app/components/text.ts index 19e80022cb..3f2dfe24c6 100644 --- a/e2e/davinci-app/components/text.ts +++ b/e2e/davinci-app/components/text.ts @@ -4,13 +4,14 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +import { dotToCamelCase } from '../helper.js'; + import type { TextCollector, - ValidatedTextCollector, Updater, + ValidatedTextCollector, Validator, } from '@forgerock/davinci-client/types'; -import { dotToCamelCase } from '../helper.js'; export default function textComponent( formEl: HTMLFormElement, diff --git a/e2e/davinci-app/main.ts b/e2e/davinci-app/main.ts index d2e72d96e7..dd81406bb8 100644 --- a/e2e/davinci-app/main.ts +++ b/e2e/davinci-app/main.ts @@ -4,39 +4,39 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import './style.css'; - import { davinci } from '@forgerock/davinci-client'; import { oidc } from '@forgerock/oidc-client'; -import type { OidcConfig } from '@forgerock/oidc-client/types'; +import { protect } from '@forgerock/protect'; + +import './style.css'; +import agreementComponent from './components/agreement.js'; +import booleanComponent from './components/boolean.js'; +import fidoComponent from './components/fido.js'; +import flowLinkComponent from './components/flow-link.js'; +import labelComponent from './components/label.js'; +import multiValueComponent from './components/multi-value.js'; +import objectValueComponent from './components/object-value.js'; +import passwordComponent from './components/password.js'; +import pollingComponent from './components/polling.js'; +import protectComponent from './components/protect.js'; +import qrCodeComponent from './components/qr-code.js'; +import singleValueComponent from './components/single-value.js'; +import socialLoginButtonComponent from './components/social-login-button.js'; +import submitButtonComponent from './components/submit-button.js'; +import textComponent from './components/text.js'; +import { serverConfigs } from './server-configs.js'; + import type { CustomLogger, - DaVinciConfig, DavinciClient, + DaVinciConfig, GetClient, InternalErrorResponse, NodeStates, ProtectCollector, RequestMiddleware, } from '@forgerock/davinci-client/types'; -import { protect } from '@forgerock/protect'; - -import textComponent from './components/text.js'; -import passwordComponent from './components/password.js'; -import submitButtonComponent from './components/submit-button.js'; -import protectComponent from './components/protect.js'; -import flowLinkComponent from './components/flow-link.js'; -import socialLoginButtonComponent from './components/social-login-button.js'; -import { serverConfigs } from './server-configs.js'; -import singleValueComponent from './components/single-value.js'; -import multiValueComponent from './components/multi-value.js'; -import labelComponent from './components/label.js'; -import objectValueComponent from './components/object-value.js'; -import fidoComponent from './components/fido.js'; -import qrCodeComponent from './components/qr-code.js'; -import agreementComponent from './components/agreement.js'; -import pollingComponent from './components/polling.js'; -import booleanComponent from './components/boolean.js'; +import type { OidcConfig } from '@forgerock/oidc-client/types'; const loggerFn = { error: () => { diff --git a/e2e/device-client-app/src/device-binding/main.ts b/e2e/device-client-app/src/device-binding/main.ts index 9dd9f5f70c..eb46b15afb 100644 --- a/e2e/device-client-app/src/device-binding/main.ts +++ b/e2e/device-client-app/src/device-binding/main.ts @@ -8,7 +8,8 @@ */ import { Console, Effect } from 'effect'; -import { getUser, LoginAndGetClient, handleError, handleSuccess } from '../utils/index.js'; + +import { getUser, handleError, handleSuccess, LoginAndGetClient } from '../utils/index.js'; const deviceBinding = Effect.gen(function* () { const client = yield* LoginAndGetClient; diff --git a/e2e/device-client-app/src/device-profile/main.ts b/e2e/device-client-app/src/device-profile/main.ts index e455442b88..25f1055004 100644 --- a/e2e/device-client-app/src/device-profile/main.ts +++ b/e2e/device-client-app/src/device-profile/main.ts @@ -8,7 +8,8 @@ */ import { Console, Effect } from 'effect'; -import { getUser, LoginAndGetClient, handleError, handleSuccess } from '../utils/index.js'; + +import { getUser, handleError, handleSuccess, LoginAndGetClient } from '../utils/index.js'; const deviceProfiling = Effect.gen(function* () { const client = yield* LoginAndGetClient; diff --git a/e2e/device-client-app/src/oath/main.ts b/e2e/device-client-app/src/oath/main.ts index 04e3758e8b..c860d338ac 100644 --- a/e2e/device-client-app/src/oath/main.ts +++ b/e2e/device-client-app/src/oath/main.ts @@ -8,7 +8,8 @@ */ import { Console, Effect } from 'effect'; -import { getUser, LoginAndGetClient, handleError, handleSuccess } from '../utils/index.js'; + +import { getUser, handleError, handleSuccess, LoginAndGetClient } from '../utils/index.js'; const oath = Effect.gen(function* () { const client = yield* LoginAndGetClient; diff --git a/e2e/device-client-app/src/push/main.ts b/e2e/device-client-app/src/push/main.ts index 97f47f0331..7f208975ce 100644 --- a/e2e/device-client-app/src/push/main.ts +++ b/e2e/device-client-app/src/push/main.ts @@ -8,7 +8,8 @@ */ import { Console, Effect } from 'effect'; -import { getUser, LoginAndGetClient, handleError, handleSuccess } from '../utils/index.js'; + +import { getUser, handleError, handleSuccess, LoginAndGetClient } from '../utils/index.js'; const push = Effect.gen(function* () { const client = yield* LoginAndGetClient; diff --git a/e2e/device-client-app/src/types.ts b/e2e/device-client-app/src/types.ts index 94692f2581..8b1d48df80 100644 --- a/e2e/device-client-app/src/types.ts +++ b/e2e/device-client-app/src/types.ts @@ -1,3 +1,3 @@ -import { deviceClient } from '@forgerock/device-client'; +import type { deviceClient } from '@forgerock/device-client'; export type DeviceClient = ReturnType; diff --git a/e2e/device-client-app/src/utils/index.ts b/e2e/device-client-app/src/utils/index.ts index d7b246ec9b..63820a7398 100644 --- a/e2e/device-client-app/src/utils/index.ts +++ b/e2e/device-client-app/src/utils/index.ts @@ -1,19 +1,22 @@ import { deviceClient } from '@forgerock/device-client'; -import type { ConfigOptions, DeviceClient } from '@forgerock/device-client/types'; import { CallbackType, Config, FRAuth, + SessionManager, + TokenManager, + UserManager, +} from '@forgerock/javascript-sdk'; +import { Console, Effect } from 'effect'; + +import type { ConfigOptions, DeviceClient } from '@forgerock/device-client/types'; +import type { FRLoginFailure, FRLoginSuccess, FRStep, NameCallback, PasswordCallback, - SessionManager, - TokenManager, - UserManager, } from '@forgerock/javascript-sdk'; -import { Console, Effect } from 'effect'; const logout = Effect.ignore( Effect.tryPromise({ diff --git a/e2e/device-client-app/src/webauthn/main.ts b/e2e/device-client-app/src/webauthn/main.ts index 89bdb4c941..4c8adeb39b 100644 --- a/e2e/device-client-app/src/webauthn/main.ts +++ b/e2e/device-client-app/src/webauthn/main.ts @@ -8,7 +8,8 @@ */ import { Console, Effect } from 'effect'; -import { getUser, LoginAndGetClient, handleError, handleSuccess } from '../utils/index.js'; + +import { getUser, handleError, handleSuccess, LoginAndGetClient } from '../utils/index.js'; const webauthn = Effect.gen(function* () { const client = yield* LoginAndGetClient; diff --git a/e2e/device-client-app/vite.config.ts b/e2e/device-client-app/vite.config.ts index f54af97750..15a91ee57c 100644 --- a/e2e/device-client-app/vite.config.ts +++ b/e2e/device-client-app/vite.config.ts @@ -1,6 +1,6 @@ /// -import { defineConfig } from 'vite'; import * as path from 'path'; +import { defineConfig } from 'vite'; const pages = ['oath', 'push', 'webauthn', 'device-binding', 'device-profile']; diff --git a/e2e/journey-app/callback-map.ts b/e2e/journey-app/callback-map.ts index a9b6e94831..9fa3448b88 100644 --- a/e2e/journey-app/callback-map.ts +++ b/e2e/journey-app/callback-map.ts @@ -5,6 +5,30 @@ * of the MIT license. See the LICENSE file for details. */ +import { + attributeInputComponent, + choiceComponent, + confirmationComponent, + deviceProfileComponent, + hiddenValueComponent, + kbaCreateComponent, + metadataComponent, + passwordComponent, + pingProtectEvaluationComponent, + pingProtectInitializeComponent, + pollingWaitComponent, + recaptchaComponent, + recaptchaEnterpriseComponent, + redirectComponent, + selectIdpComponent, + suspendedTextOutputComponent, + termsAndConditionsComponent, + textInputComponent, + textOutputComponent, + validatedPasswordComponent, + validatedUsernameComponent, +} from './components/index.js'; + import type { AttributeInputCallback, BaseCallback, @@ -31,30 +55,6 @@ import type { ValidatedCreateUsernameCallback, } from '@forgerock/journey-client/types'; -import { - attributeInputComponent, - choiceComponent, - confirmationComponent, - deviceProfileComponent, - hiddenValueComponent, - kbaCreateComponent, - metadataComponent, - passwordComponent, - pingProtectEvaluationComponent, - pingProtectInitializeComponent, - pollingWaitComponent, - recaptchaComponent, - recaptchaEnterpriseComponent, - redirectComponent, - selectIdpComponent, - suspendedTextOutputComponent, - termsAndConditionsComponent, - textInputComponent, - textOutputComponent, - validatedPasswordComponent, - validatedUsernameComponent, -} from './components/index.js'; - /** * Renders a callback component based on its type * @param journeyEl - The container element to append the component to diff --git a/e2e/journey-app/components/device-profile.ts b/e2e/journey-app/components/device-profile.ts index d452970ccc..5e9b56aeac 100644 --- a/e2e/journey-app/components/device-profile.ts +++ b/e2e/journey-app/components/device-profile.ts @@ -5,6 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ import { Device } from '@forgerock/journey-client/device'; + import type { DeviceProfileCallback } from '@forgerock/journey-client/types'; /** diff --git a/e2e/journey-app/components/ping-protect-evaluation.ts b/e2e/journey-app/components/ping-protect-evaluation.ts index 403e284f25..68e77e9b79 100644 --- a/e2e/journey-app/components/ping-protect-evaluation.ts +++ b/e2e/journey-app/components/ping-protect-evaluation.ts @@ -4,9 +4,10 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { PingOneProtectEvaluationCallback } from '@forgerock/journey-client/types'; import { getProtectInstance } from './ping-protect-initialize.js'; +import type { PingOneProtectEvaluationCallback } from '@forgerock/journey-client/types'; + /** * PingOne Protect Evaluation Component * Automatically collects device and behavioral signals using the Protect SDK diff --git a/e2e/journey-app/components/ping-protect-initialize.ts b/e2e/journey-app/components/ping-protect-initialize.ts index 6cbe21db28..90ae6014dd 100644 --- a/e2e/journey-app/components/ping-protect-initialize.ts +++ b/e2e/journey-app/components/ping-protect-initialize.ts @@ -5,6 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ import { protect } from '@forgerock/protect'; + import type { PingOneProtectInitializeCallback } from '@forgerock/journey-client/types'; // Global storage for protect instance to be used by evaluation component diff --git a/e2e/journey-app/components/qr-code.ts b/e2e/journey-app/components/qr-code.ts index 1c1d5ff746..af6c02473a 100644 --- a/e2e/journey-app/components/qr-code.ts +++ b/e2e/journey-app/components/qr-code.ts @@ -5,7 +5,8 @@ * of the MIT license. See the LICENSE file for details. */ import { QRCode } from '@forgerock/journey-client/qr-code'; -import type { JourneyStep, ConfirmationCallback } from '@forgerock/journey-client/types'; + +import type { ConfirmationCallback, JourneyStep } from '@forgerock/journey-client/types'; export function renderQRCodeStep(journeyEl: HTMLDivElement, step: JourneyStep): boolean { if (!QRCode.isQRCodeStep(step)) { diff --git a/e2e/journey-app/components/recovery-codes.ts b/e2e/journey-app/components/recovery-codes.ts index c74ab3ee18..e97da7ec60 100644 --- a/e2e/journey-app/components/recovery-codes.ts +++ b/e2e/journey-app/components/recovery-codes.ts @@ -5,7 +5,8 @@ * of the MIT license. See the LICENSE file for details. */ import { RecoveryCodes } from '@forgerock/journey-client/recovery-codes'; -import type { JourneyStep, ConfirmationCallback } from '@forgerock/journey-client/types'; + +import type { ConfirmationCallback, JourneyStep } from '@forgerock/journey-client/types'; export function renderRecoveryCodesStep(journeyEl: HTMLDivElement, step: JourneyStep): boolean { if (!RecoveryCodes.isDisplayStep(step)) { diff --git a/e2e/journey-app/components/webauthn-step.ts b/e2e/journey-app/components/webauthn-step.ts index fe136b202b..c8d32a14cf 100644 --- a/e2e/journey-app/components/webauthn-step.ts +++ b/e2e/journey-app/components/webauthn-step.ts @@ -5,11 +5,12 @@ * of the MIT license. See the LICENSE file for details. */ -import type { BaseCallback, JourneyStep } from '@forgerock/journey-client/types'; import { WebAuthn, WebAuthnStepType } from '@forgerock/journey-client/webauthn'; import { renderCallbacks } from '../callback-map.js'; +import type { BaseCallback, JourneyStep } from '@forgerock/journey-client/types'; + type WebAuthnStepHandlerResult = { callbacksRendered: boolean; didSubmit: boolean; diff --git a/e2e/journey-app/main.ts b/e2e/journey-app/main.ts index 3b61558b4d..4fa8b249b0 100644 --- a/e2e/journey-app/main.ts +++ b/e2e/journey-app/main.ts @@ -4,19 +4,18 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import './style.css'; - import { journey } from '@forgerock/journey-client'; -import type { JourneyClient, RequestMiddleware } from '@forgerock/journey-client/types'; - +import './style.css'; import { renderCallbacks } from './callback-map.js'; import { renderDeleteDevicesSection } from './components/delete-device.js'; import { renderQRCodeStep } from './components/qr-code.js'; import { renderRecoveryCodesStep } from './components/recovery-codes.js'; -import { deleteWebAuthnDevice } from './services/delete-webauthn-device.js'; import { handleWebAuthnStep } from './components/webauthn-step.js'; import { serverConfigs } from './server-configs.js'; +import { deleteWebAuthnDevice } from './services/delete-webauthn-device.js'; + +import type { JourneyClient, RequestMiddleware } from '@forgerock/journey-client/types'; const qs = window.location.search; const searchParams = new URLSearchParams(qs); diff --git a/e2e/journey-app/package.json b/e2e/journey-app/package.json index 7cc9e67485..917d423425 100644 --- a/e2e/journey-app/package.json +++ b/e2e/journey-app/package.json @@ -11,11 +11,11 @@ "serve": "pnpm nx nxServe" }, "dependencies": { + "@forgerock/device-client": "workspace:*", "@forgerock/journey-client": "workspace:*", "@forgerock/oidc-client": "workspace:*", "@forgerock/protect": "workspace:*", - "@forgerock/sdk-logger": "workspace:*", - "@forgerock/device-client": "workspace:*" + "@forgerock/sdk-logger": "workspace:*" }, "nx": { "tags": ["scope:e2e"] diff --git a/e2e/journey-app/services/delete-webauthn-device.ts b/e2e/journey-app/services/delete-webauthn-device.ts index e8c5e0827b..c9c3825643 100644 --- a/e2e/journey-app/services/delete-webauthn-device.ts +++ b/e2e/journey-app/services/delete-webauthn-device.ts @@ -6,8 +6,9 @@ */ import { deviceClient as createDeviceClient } from '@forgerock/device-client'; + import type { WebAuthnDevice } from '@forgerock/device-client/types'; -import { JourneyClientConfig } from '@forgerock/journey-client/types'; +import type { JourneyClientConfig } from '@forgerock/journey-client/types'; /** * Derives the AM base URL from an OIDC well-known URL. diff --git a/e2e/mock-api-v2/src/handlers/authorize.handler.ts b/e2e/mock-api-v2/src/handlers/authorize.handler.ts index c636c9e762..d316f1e62d 100644 --- a/e2e/mock-api-v2/src/handlers/authorize.handler.ts +++ b/e2e/mock-api-v2/src/handlers/authorize.handler.ts @@ -4,10 +4,11 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect, pipe } from 'effect'; -import { MockApi } from '../spec.js'; import { HttpApiBuilder, HttpApiError, HttpServerResponse } from '@effect/platform'; +import { Effect, pipe } from 'effect'; + import { getFirstElementAndRespond } from '../services/mock-env-helpers/index.js'; +import { MockApi } from '../spec.js'; const AuthorizeHandlerMock = HttpApiBuilder.group(MockApi, 'Authorization', (handlers) => handlers.handle('authorize', ({ urlParams }) => diff --git a/e2e/mock-api-v2/src/handlers/capabilities.handler.ts b/e2e/mock-api-v2/src/handlers/capabilities.handler.ts index d82c62f3a5..28da47fc32 100644 --- a/e2e/mock-api-v2/src/handlers/capabilities.handler.ts +++ b/e2e/mock-api-v2/src/handlers/capabilities.handler.ts @@ -4,17 +4,18 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect, pipe } from 'effect'; -import { MockApi } from '../spec.js'; import { HttpApiBuilder, HttpApiError, HttpServerRequest, HttpServerResponse, } from '@effect/platform'; -import { responseMap } from '../responses/index.js'; +import { Effect, pipe } from 'effect'; + import { validator } from '../helpers/match.js'; +import { responseMap } from '../responses/index.js'; import { returnSuccessResponseRedirect } from '../responses/return-success-redirect.js'; +import { MockApi } from '../spec.js'; const CapabilitiesHandlerMock = HttpApiBuilder.group(MockApi, 'Capabilities', (handlers) => handlers.handle('capabilities', ({ payload }) => diff --git a/e2e/mock-api-v2/src/handlers/end-session.handler.ts b/e2e/mock-api-v2/src/handlers/end-session.handler.ts index c25219e38b..b71d223e84 100644 --- a/e2e/mock-api-v2/src/handlers/end-session.handler.ts +++ b/e2e/mock-api-v2/src/handlers/end-session.handler.ts @@ -4,10 +4,11 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect, Console } from 'effect'; import { HttpApiBuilder, HttpServerRequest } from '@effect/platform'; -import { MockApi } from '../spec.js'; +import { Console, Effect } from 'effect'; + import { SessionStorage } from '../services/session.service.js'; +import { MockApi } from '../spec.js'; export const EndSessionHandlerMock = HttpApiBuilder.group( MockApi, diff --git a/e2e/mock-api-v2/src/handlers/healthcheck.handler.ts b/e2e/mock-api-v2/src/handlers/healthcheck.handler.ts index fd9a27ce26..b3d2a25ecd 100644 --- a/e2e/mock-api-v2/src/handlers/healthcheck.handler.ts +++ b/e2e/mock-api-v2/src/handlers/healthcheck.handler.ts @@ -1,7 +1,8 @@ import { HttpApiBuilder } from '@effect/platform'; -import { MockApi } from '../spec.js'; import { Effect } from 'effect'; +import { MockApi } from '../spec.js'; + const HealthCheckLive = HttpApiBuilder.group(MockApi, 'Healthcheck', (handlers) => handlers.handle('HealthCheck', () => Effect.succeed('Healthy').pipe(Effect.withSpan('HealthCheck')), diff --git a/e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts b/e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts index f6b4d2a76e..f24ae39e0b 100644 --- a/e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts +++ b/e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts @@ -4,10 +4,11 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect } from 'effect'; -import { MockApi } from '../spec.js'; import { HttpApiBuilder } from '@effect/platform'; import { HttpServerRequest } from '@effect/platform/HttpServerRequest'; +import { Effect } from 'effect'; + +import { MockApi } from '../spec.js'; const OpenidConfigMock = HttpApiBuilder.group(MockApi, 'OpenIDConfig', (handlers) => handlers.handle('openid', ({ path: { envid } }) => diff --git a/e2e/mock-api-v2/src/handlers/revoke.handler.ts b/e2e/mock-api-v2/src/handlers/revoke.handler.ts index b25c8da876..7d3d8741e2 100644 --- a/e2e/mock-api-v2/src/handlers/revoke.handler.ts +++ b/e2e/mock-api-v2/src/handlers/revoke.handler.ts @@ -4,11 +4,12 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { MockApi } from '../spec.js'; -import { Tokens } from '../services/tokens.service.js'; import { HttpApiBuilder } from '@effect/platform'; import { Effect } from 'effect'; +import { Tokens } from '../services/tokens.service.js'; +import { MockApi } from '../spec.js'; + const RevokeTokenHandler = HttpApiBuilder.group(MockApi, 'Revoke', (handlers) => handlers.handle('RevokeToken', () => Effect.gen(function* () { diff --git a/e2e/mock-api-v2/src/handlers/token.handler.ts b/e2e/mock-api-v2/src/handlers/token.handler.ts index 5eefdd073d..375f8bc172 100644 --- a/e2e/mock-api-v2/src/handlers/token.handler.ts +++ b/e2e/mock-api-v2/src/handlers/token.handler.ts @@ -4,11 +4,12 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { MockApi } from '../spec.js'; -import { Tokens } from '../services/tokens.service.js'; import { HttpApiBuilder } from '@effect/platform'; import { Effect } from 'effect'; +import { Tokens } from '../services/tokens.service.js'; +import { MockApi } from '../spec.js'; + const TokensHandler = HttpApiBuilder.group(MockApi, 'Tokens', (handlers) => handlers.handle('Tokens', () => Effect.gen(function* () { diff --git a/e2e/mock-api-v2/src/handlers/userinfo.handler.ts b/e2e/mock-api-v2/src/handlers/userinfo.handler.ts index bea15715eb..3616334172 100644 --- a/e2e/mock-api-v2/src/handlers/userinfo.handler.ts +++ b/e2e/mock-api-v2/src/handlers/userinfo.handler.ts @@ -4,11 +4,12 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect } from 'effect'; -import { MockApi } from '../spec.js'; -import { UserInfo } from '../services/userinfo.service.js'; import { HttpApiBuilder, HttpApiError } from '@effect/platform'; +import { Effect } from 'effect'; + import { BearerToken } from '../middleware/Authorization.js'; +import { UserInfo } from '../services/userinfo.service.js'; +import { MockApi } from '../spec.js'; const UserInfoMockHandler = HttpApiBuilder.group(MockApi, 'ProtectedRequests', (handlers) => handlers.handle('UserInfo', () => diff --git a/e2e/mock-api-v2/src/helpers/match.ts b/e2e/mock-api-v2/src/helpers/match.ts index 511f2ffda2..0624b19871 100644 --- a/e2e/mock-api-v2/src/helpers/match.ts +++ b/e2e/mock-api-v2/src/helpers/match.ts @@ -4,10 +4,12 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Effect, Match, Schema } from 'effect'; - import { HttpApiError } from '@effect/platform'; -import { CapabilitiesRequestBody } from '../schemas/capabilities/capabilities.request.schema.js'; +import { Effect, Match } from 'effect'; + +import type { Schema } from 'effect'; + +import type { CapabilitiesRequestBody } from '../schemas/capabilities/capabilities.request.schema.js'; type PingRequestData = Schema.Schema.Type; /** diff --git a/e2e/mock-api-v2/src/main.ts b/e2e/mock-api-v2/src/main.ts index 92e2acf3ee..63da6b62a5 100644 --- a/e2e/mock-api-v2/src/main.ts +++ b/e2e/mock-api-v2/src/main.ts @@ -4,27 +4,28 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Layer } from 'effect'; -import { NodeHttpServer, NodeRuntime } from '@effect/platform-node'; -import { MockApi } from './spec.js'; +import { NodeSdk } from '@effect/opentelemetry'; import { HttpApiBuilder, HttpApiSwagger, HttpMiddleware, HttpServer } from '@effect/platform'; +import { NodeHttpServer, NodeRuntime } from '@effect/platform-node'; +import { BatchSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base'; +import { Layer } from 'effect'; import { createServer } from 'node:http'; -import { HealthCheckLive } from './handlers/healthcheck.handler.js'; -import { OpenidConfigMock } from './handlers/open-id-configuration.handler.js'; -import { IncrementStepIndexMock } from './middleware/CookieMiddleware.js'; + import { AuthorizeHandlerMock } from './handlers/authorize.handler.js'; import { CapabilitiesHandlerMock } from './handlers/capabilities.handler.js'; -import { TokensMock } from './services/tokens.service.js'; +import { EndSessionHandlerMock } from './handlers/end-session.handler.js'; +import { HealthCheckLive } from './handlers/healthcheck.handler.js'; +import { OpenidConfigMock } from './handlers/open-id-configuration.handler.js'; +import { RevokeTokenHandler } from './handlers/revoke.handler.js'; import { TokensHandler } from './handlers/token.handler.js'; import { UserInfoMockHandler } from './handlers/userinfo.handler.js'; -import { UserInfoMockService } from './services/userinfo.service.js'; import { AuthorizationMock } from './middleware/Authorization.js'; +import { IncrementStepIndexMock } from './middleware/CookieMiddleware.js'; import { SessionMiddlewareMock } from './middleware/Session.js'; import { SessionStorage } from './services/session.service.js'; -import { NodeSdk } from '@effect/opentelemetry'; -import { BatchSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base'; -import { EndSessionHandlerMock } from './handlers/end-session.handler.js'; -import { RevokeTokenHandler } from './handlers/revoke.handler.js'; +import { TokensMock } from './services/tokens.service.js'; +import { UserInfoMockService } from './services/userinfo.service.js'; +import { MockApi } from './spec.js'; const Services = [ Layer.provide(TokensMock), diff --git a/e2e/mock-api-v2/src/middleware/Authorization.ts b/e2e/mock-api-v2/src/middleware/Authorization.ts index 1cfe3d8bee..a9b0826446 100644 --- a/e2e/mock-api-v2/src/middleware/Authorization.ts +++ b/e2e/mock-api-v2/src/middleware/Authorization.ts @@ -1,5 +1,5 @@ -import { Unauthorized } from '@effect/platform/HttpApiError'; import { HttpApiMiddleware, HttpApiSecurity, OpenApi } from '@effect/platform'; +import { Unauthorized } from '@effect/platform/HttpApiError'; import { Brand, Context, Effect, Layer, Redacted } from 'effect'; type BearerTokenValue = string & Brand.Brand<'BearerToken'>; diff --git a/e2e/mock-api-v2/src/middleware/Session.ts b/e2e/mock-api-v2/src/middleware/Session.ts index c04cbec6ee..8923facf2c 100644 --- a/e2e/mock-api-v2/src/middleware/Session.ts +++ b/e2e/mock-api-v2/src/middleware/Session.ts @@ -1,7 +1,10 @@ import { HttpApiError, HttpApiMiddleware, HttpServerRequest } from '@effect/platform'; -import { SessionData, SessionStorage } from '../services/session.service.js'; import { Context, Effect, Layer } from 'effect'; +import { SessionStorage } from '../services/session.service.js'; + +import type { SessionData } from '../services/session.service.js'; + class Session extends Context.Tag('Session')() {} export class SessionMiddleware extends HttpApiMiddleware.Tag()('Session', { diff --git a/e2e/mock-api-v2/src/responses/index.ts b/e2e/mock-api-v2/src/responses/index.ts index 0fe59a0a7c..77e91a54ef 100644 --- a/e2e/mock-api-v2/src/responses/index.ts +++ b/e2e/mock-api-v2/src/responses/index.ts @@ -5,10 +5,10 @@ * of the MIT license. See the LICENSE file for details. */ import { Array } from 'effect'; -import { UsernamePassword } from './username-password.js'; -import { returnSuccessResponseRedirect } from './return-success-redirect.js'; import { InvalidUsernamePassword } from './invalid-username-password.js'; +import { returnSuccessResponseRedirect } from './return-success-redirect.js'; +import { UsernamePassword } from './username-password.js'; type ResponseMapKeys = keyof typeof responseMap; const responseMap = { diff --git a/e2e/mock-api-v2/src/services/mock-env-helpers/index.ts b/e2e/mock-api-v2/src/services/mock-env-helpers/index.ts index cb93a0616d..3e25bcdc52 100644 --- a/e2e/mock-api-v2/src/services/mock-env-helpers/index.ts +++ b/e2e/mock-api-v2/src/services/mock-env-helpers/index.ts @@ -4,15 +4,18 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Array, Effect, Option, pipe, Schema } from 'effect'; +import { HttpApiError } from '@effect/platform'; +import { Array, Effect, Option, pipe } from 'effect'; import { UnableToFindNextStep } from '../../errors/index.js'; -import { ResponseMapKeys, responseMap } from '../../responses/index.js'; -import { CapabilitiesResponse } from '../../schemas/capabilities/capabilities.response.schema.js'; - -import { QueryTypes } from '../../types/index.js'; import { validator } from '../../helpers/match.js'; -import { HttpApiError } from '@effect/platform'; +import { responseMap } from '../../responses/index.js'; + +import type { Schema } from 'effect'; + +import type { ResponseMapKeys } from '../../responses/index.js'; +import type { CapabilitiesResponse } from '../../schemas/capabilities/capabilities.response.schema.js'; +import type { QueryTypes } from '../../types/index.js'; /** * Given data in the shape of Ping's Request formData.value diff --git a/e2e/mock-api-v2/src/services/tokens.service.ts b/e2e/mock-api-v2/src/services/tokens.service.ts index 5c2df0c5b5..8889885bcb 100644 --- a/e2e/mock-api-v2/src/services/tokens.service.ts +++ b/e2e/mock-api-v2/src/services/tokens.service.ts @@ -4,14 +4,17 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Context, Effect, Layer, Schema } from 'effect'; import { HttpApiError } from '@effect/platform'; -import { tokenResponseBody } from '../responses/token/token.js'; -import { TokenResponseBody } from '../schemas/token/token.schema.js'; +import { Context, Effect, Layer } from 'effect'; + import { revokeResponseBody } from '../responses/revoke/revoke.js'; -import { RevokeResponseBody } from '../schemas/revoke/revoke.schema.js'; +import { tokenResponseBody } from '../responses/token/token.js'; + +import type { Schema } from 'effect'; -import { HeaderTypes } from '../types/index.js'; +import type { RevokeResponseBody } from '../schemas/revoke/revoke.schema.js'; +import type { TokenResponseBody } from '../schemas/token/token.schema.js'; +import type { HeaderTypes } from '../types/index.js'; type TokensResponseBody = Schema.Schema.Type; type RevokeTokenResponseBody = Schema.Schema.Type; diff --git a/e2e/mock-api-v2/src/services/userinfo.service.ts b/e2e/mock-api-v2/src/services/userinfo.service.ts index b9e3dabc45..f6a990e938 100644 --- a/e2e/mock-api-v2/src/services/userinfo.service.ts +++ b/e2e/mock-api-v2/src/services/userinfo.service.ts @@ -4,12 +4,15 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Layer, Schema } from 'effect'; -import { Effect, Context } from 'effect'; +import { HttpApiError } from '@effect/platform'; +import { Layer } from 'effect'; +import { Context, Effect } from 'effect'; import { userInfoResponse } from '../responses/userinfo/userinfo.js'; -import { UserInfoSchema } from '../schemas/userinfo/userinfo.schema.js'; -import { HttpApiError } from '@effect/platform'; + +import type { Schema } from 'effect'; + +import type { UserInfoSchema } from '../schemas/userinfo/userinfo.schema.js'; /*** * This file should be converted to a Layer that uses Request diff --git a/e2e/mock-api-v2/src/spec.ts b/e2e/mock-api-v2/src/spec.ts index 3981a26464..fb5c4a9d45 100644 --- a/e2e/mock-api-v2/src/spec.ts +++ b/e2e/mock-api-v2/src/spec.ts @@ -4,31 +4,31 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Schema } from 'effect'; import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from '@effect/platform'; -import { openIdConfigurationResponseSchema } from './schemas/open-id-configuration/open-id-configuration-response.schema.js'; -import { TokenResponseBody } from './schemas/token/token.schema.js'; -import { UserInfoSchema } from './schemas/userinfo/userinfo.schema.js'; +import { Schema } from 'effect'; + +import { addStepCookie } from './addStepCookie.openapi.js'; import { Authorization } from './middleware/Authorization.js'; +import { IncrementStepIndex } from './middleware/CookieMiddleware.js'; import { SessionMiddleware } from './middleware/Session.js'; +import { DavinciAuthorizeHeaders, DavinciAuthorizeQuery } from './schemas/authorize.schema.js'; +import { CapabilitiesHeaders } from './schemas/capabilities/capabilities.headers.schema.js'; +import { CapabilitiesPathParams } from './schemas/capabilities/capabilities.path.schema.js'; +import { CapabilitiesRequestBody } from './schemas/capabilities/capabilities.request.schema.js'; +import { CapabilitiesResponse } from './schemas/capabilities/capabilities.response.schema.js'; import { - EndSessionQuery, EndSessionHeaders, EndSessionPath, + EndSessionQuery, } from './schemas/end-session.schema.js'; +import { openIdConfigurationResponseSchema } from './schemas/open-id-configuration/open-id-configuration-response.schema.js'; import { RevokePath, RevokeRequestBody, RevokeResponseBody, } from './schemas/revoke/revoke.schema.js'; - -import { CapabilitiesHeaders } from './schemas/capabilities/capabilities.headers.schema.js'; -import { CapabilitiesResponse } from './schemas/capabilities/capabilities.response.schema.js'; -import { DavinciAuthorizeHeaders, DavinciAuthorizeQuery } from './schemas/authorize.schema.js'; -import { CapabilitiesPathParams } from './schemas/capabilities/capabilities.path.schema.js'; -import { CapabilitiesRequestBody } from './schemas/capabilities/capabilities.request.schema.js'; -import { addStepCookie } from './addStepCookie.openapi.js'; -import { IncrementStepIndex } from './middleware/CookieMiddleware.js'; +import { TokenResponseBody } from './schemas/token/token.schema.js'; +import { UserInfoSchema } from './schemas/userinfo/userinfo.schema.js'; const MockApi = HttpApi.make('MyApi') .annotate(OpenApi.Title, 'PingOne OIDC and OAuth2 Mock API') diff --git a/e2e/mock-api-v2/src/types/index.ts b/e2e/mock-api-v2/src/types/index.ts index 0c44c3741b..23cc017a7a 100644 --- a/e2e/mock-api-v2/src/types/index.ts +++ b/e2e/mock-api-v2/src/types/index.ts @@ -4,9 +4,13 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Schema } from 'effect'; -import { DavinciAuthorizeHeaders, DavinciAuthorizeQuery } from '../schemas/authorize.schema.js'; -import { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema.js'; +import type { Schema } from 'effect'; + +import type { + DavinciAuthorizeHeaders, + DavinciAuthorizeQuery, +} from '../schemas/authorize.schema.js'; +import type { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema.js'; type QueryTypes = Schema.Schema.Type | null; diff --git a/e2e/oidc-app/src/utils/oidc-app.ts b/e2e/oidc-app/src/utils/oidc-app.ts index f8565a10c7..9852f290e1 100644 --- a/e2e/oidc-app/src/utils/oidc-app.ts +++ b/e2e/oidc-app/src/utils/oidc-app.ts @@ -7,6 +7,7 @@ * */ import { oidc } from '@forgerock/oidc-client'; + import type { AuthorizationError, GenericError, diff --git a/e2e/oidc-app/vite.config.ts b/e2e/oidc-app/vite.config.ts index c40a554f9f..3d4d99d4c6 100644 --- a/e2e/oidc-app/vite.config.ts +++ b/e2e/oidc-app/vite.config.ts @@ -1,7 +1,7 @@ /// -import { defineConfig } from 'vite'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; +import { defineConfig } from 'vite'; const __dirname = dirname(fileURLToPath(import.meta.url)); const pages = ['ping-am', 'ping-one', 'par']; diff --git a/e2e/protect-app/src/protect-native.ts b/e2e/protect-app/src/protect-native.ts index 9e76487f03..0215bfd1d6 100644 --- a/e2e/protect-app/src/protect-native.ts +++ b/e2e/protect-app/src/protect-native.ts @@ -7,22 +7,26 @@ * */ -import './style.css'; -import { protect } from '@forgerock/protect'; -import type { Protect } from '@forgerock/protect/types'; import { CallbackType, Config, FRAuth, - FRStep, FRUser, + TokenManager, + UserManager, +} from '@forgerock/javascript-sdk'; +import { protect } from '@forgerock/protect'; + +import './style.css'; + +import type { + FRStep, NameCallback, PasswordCallback, PingOneProtectEvaluationCallback, PingOneProtectInitializeCallback, - TokenManager, - UserManager, } from '@forgerock/javascript-sdk'; +import type { Protect } from '@forgerock/protect/types'; const protectAPI: Protect = protect({ envId: '02fb4743-189a-4bc7-9d6c-a919edfe6447' }); const FATAL = 'Fatal'; diff --git a/eslint.config.mjs b/eslint.config.mjs index b38bd77ab9..c198fb6ebc 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,6 +12,7 @@ import packageJson from 'eslint-plugin-package-json'; import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin'; import nxEslintPlugin from '@nx/eslint-plugin'; import eslintPluginImport from 'eslint-plugin-import'; +import simpleImportSort from 'eslint-plugin-simple-import-sort'; import typescriptEslintParser from '@typescript-eslint/parser'; const compat = new FlatCompat({ @@ -39,6 +40,38 @@ export default [ '@typescript-eslint': typescriptEslintEslintPlugin, '@nx': nxEslintPlugin, import: eslintPluginImport, + 'simple-import-sort': simpleImportSort, + }, + }, + { + rules: { + 'simple-import-sort/imports': [ + 'error', + { + groups: [ + // value imports from packages + ['^\\u0000[^.$]', '^[^.$]'], + // value imports from relative paths + ['^\\u0000\\.', '^\\.'], + // type-only imports from packages + ['^[^.$].*\\u0000$'], + // type-only imports from relative paths + ['^(\\.).*\\u0000$'], + ], + }, + ], + }, + }, + { + files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'], + rules: { + '@typescript-eslint/consistent-type-imports': [ + 'error', + { + prefer: 'type-imports', + fixStyle: 'separate-type-imports', + }, + ], }, }, { diff --git a/package.json b/package.json index 276cd4db39..e30ff929f6 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "eslint-plugin-package-json": "0.91.1", "eslint-plugin-playwright": "^2.0.0", "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-simple-import-sort": "^13.0.0", "fast-check": "^4.0.0", "jiti": "2.6.1", "jsdom": "27.4.0", diff --git a/packages/davinci-client/api-report/davinci-client.api.md b/packages/davinci-client/api-report/davinci-client.api.md index 44a54bf15e..81d4923e79 100644 --- a/packages/davinci-client/api-report/davinci-client.api.md +++ b/packages/davinci-client/api-report/davinci-client.api.md @@ -12,7 +12,7 @@ import { CustomLogger } from '@forgerock/sdk-logger'; import { FetchArgs } from '@reduxjs/toolkit/query'; import { FetchBaseQueryError } from '@reduxjs/toolkit/query'; import { FetchBaseQueryMeta } from '@reduxjs/toolkit/query'; -import { GenericError } from '@forgerock/sdk-types'; +import type { GenericError } from '@forgerock/sdk-types'; import { LogLevel } from '@forgerock/sdk-logger'; import { MutationDefinition } from '@reduxjs/toolkit/query'; import type { MutationResultSelectorResult } from '@reduxjs/toolkit/query'; diff --git a/packages/davinci-client/api-report/davinci-client.types.api.md b/packages/davinci-client/api-report/davinci-client.types.api.md index 62ebe0ae37..f9f32be49b 100644 --- a/packages/davinci-client/api-report/davinci-client.types.api.md +++ b/packages/davinci-client/api-report/davinci-client.types.api.md @@ -12,7 +12,7 @@ import { CustomLogger } from '@forgerock/sdk-logger'; import { FetchArgs } from '@reduxjs/toolkit/query'; import { FetchBaseQueryError } from '@reduxjs/toolkit/query'; import { FetchBaseQueryMeta } from '@reduxjs/toolkit/query'; -import { GenericError } from '@forgerock/sdk-types'; +import type { GenericError } from '@forgerock/sdk-types'; import { LogLevel } from '@forgerock/sdk-logger'; import { MutationDefinition } from '@reduxjs/toolkit/query'; import type { MutationResultSelectorResult } from '@reduxjs/toolkit/query'; diff --git a/packages/davinci-client/src/lib/client.store.effects.test.ts b/packages/davinci-client/src/lib/client.store.effects.test.ts index 365118aac0..0714104d23 100644 --- a/packages/davinci-client/src/lib/client.store.effects.test.ts +++ b/packages/davinci-client/src/lib/client.store.effects.test.ts @@ -5,16 +5,17 @@ * of the MIT license. See the LICENSE file for details. */ +import { it } from '@effect/vitest'; import { Micro } from 'effect'; import { describe, expect, vi } from 'vitest'; -import { it } from '@effect/vitest'; import { buildChallengeEndpoint, - isChallengeStillPending, - interpretChallengeResponse, getPollingModeµ, + interpretChallengeResponse, + isChallengeStillPending, } from './client.store.effects.js'; + import type { PollDispatchResult } from './client.store.effects.js'; import type { PollingCollector } from './collector.types.js'; diff --git a/packages/davinci-client/src/lib/client.store.effects.ts b/packages/davinci-client/src/lib/client.store.effects.ts index 9923ea4b67..5828de19d7 100644 --- a/packages/davinci-client/src/lib/client.store.effects.ts +++ b/packages/davinci-client/src/lib/client.store.effects.ts @@ -6,19 +6,19 @@ */ import { Micro } from 'effect'; -import { SerializedError } from '@reduxjs/toolkit/react'; -import { FetchBaseQueryError } from '@reduxjs/toolkit/query/react'; + +import { createInternalError, isInternalError } from './client.store.utils.js'; +import { davinciApi } from './davinci.api.js'; +import { nodeSlice } from './node.slice.js'; import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { FetchBaseQueryError } from '@reduxjs/toolkit/query/react'; +import type { SerializedError } from '@reduxjs/toolkit/react'; import type { ClientStore, RootState } from './client.store.utils.js'; -import type { PollingStatus, InternalErrorResponse } from './client.types.js'; +import type { InternalErrorResponse, PollingStatus } from './client.types.js'; import type { PollingCollector } from './collector.types.js'; -import { createInternalError, isInternalError } from './client.store.utils.js'; -import { davinciApi } from './davinci.api.js'; -import { nodeSlice } from './node.slice.js'; - /** * Shape returned by RTK Query's dispatch for the poll endpoint. */ diff --git a/packages/davinci-client/src/lib/client.store.ts b/packages/davinci-client/src/lib/client.store.ts index 880bdc8e49..027e40a669 100644 --- a/packages/davinci-client/src/lib/client.store.ts +++ b/packages/davinci-client/src/lib/client.store.ts @@ -4,12 +4,13 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { Micro } from 'effect'; -import { exitIsFail, exitIsSuccess } from 'effect/Micro'; import { type CustomLogger, logger as loggerFn, type LogLevel } from '@forgerock/sdk-logger'; +import { createWellknownError, isGenericError } from '@forgerock/sdk-utilities'; import { createStorage } from '@forgerock/storage'; -import { isGenericError, createWellknownError } from '@forgerock/sdk-utilities'; +import { Micro } from 'effect'; +import { exitIsFail, exitIsSuccess } from 'effect/Micro'; +import { getPollingModeµ, pollingµ } from './client.store.effects.js'; /** * Import RTK slices and api */ @@ -19,13 +20,32 @@ import { handleUpdateValidateError, type RootState, } from './client.store.utils.js'; -import { pollingµ, getPollingModeµ } from './client.store.effects.js'; -import { nodeSlice } from './node.slice.js'; -import { davinciApi } from './davinci.api.js'; +import { returnValidator } from './collector.utils.js'; import { configSlice } from './config.slice.js'; +import { davinciApi } from './davinci.api.js'; +import { nodeSlice } from './node.slice.js'; +import { returnPasswordPolicyValidator } from './password-policy.rules.js'; import { wellknownApi } from './wellknown.api.js'; import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; + +import type { + CollectorValueTypes, + InitFlow, + InternalErrorResponse, + NodeStates, + Poller, + Updater, + Validator, +} from './client.types.js'; +import type { + AutoCollectors, + MultiSelectCollector, + MultiValueCollectors, + ObjectValueCollectors, + PollingCollector, + SingleValueCollectors, +} from './collector.types.js'; /** * Import the DaVinciRequest types */ @@ -36,25 +56,6 @@ import type { OutgoingQueryParams, StartOptions, } from './davinci.types.js'; -import type { - SingleValueCollectors, - MultiSelectCollector, - ObjectValueCollectors, - AutoCollectors, - PollingCollector, - MultiValueCollectors, -} from './collector.types.js'; -import type { - InitFlow, - InternalErrorResponse, - NodeStates, - Updater, - Validator, - Poller, - CollectorValueTypes, -} from './client.types.js'; -import { returnValidator } from './collector.utils.js'; -import { returnPasswordPolicyValidator } from './password-policy.rules.js'; import type { ContinueNode, StartNode } from './node.types.js'; /** diff --git a/packages/davinci-client/src/lib/client.store.utils.ts b/packages/davinci-client/src/lib/client.store.utils.ts index 32f265c45a..f8da36d9d5 100644 --- a/packages/davinci-client/src/lib/client.store.utils.ts +++ b/packages/davinci-client/src/lib/client.store.utils.ts @@ -6,18 +6,18 @@ */ import { configureStore } from '@reduxjs/toolkit'; -import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; +import { configSlice } from './config.slice.js'; +import { davinciApi } from './davinci.api.js'; +import { nodeSlice } from './node.slice.js'; +import { wellknownApi } from './wellknown.api.js'; + import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; import type { GenericError } from '@forgerock/sdk-types'; -import type { ErrorNode, ContinueNode, StartNode, SuccessNode } from '../types.js'; +import type { ContinueNode, ErrorNode, StartNode, SuccessNode } from '../types.js'; import type { InternalErrorResponse } from './client.types.js'; -import { configSlice } from './config.slice.js'; -import { nodeSlice } from './node.slice.js'; -import { davinciApi } from './davinci.api.js'; -import { wellknownApi } from './wellknown.api.js'; - export function createClientStore({ requestMiddleware, logger, diff --git a/packages/davinci-client/src/lib/client.types.test-d.ts b/packages/davinci-client/src/lib/client.types.test-d.ts index aaafff1381..c9337b97c3 100644 --- a/packages/davinci-client/src/lib/client.types.test-d.ts +++ b/packages/davinci-client/src/lib/client.types.test-d.ts @@ -15,7 +15,7 @@ import type { InternalErrorResponse, Updater, } from './client.types.js'; -import type { ErrorNode, FailureNode, ContinueNode, StartNode, SuccessNode } from './node.types.js'; +import type { ContinueNode, ErrorNode, FailureNode, StartNode, SuccessNode } from './node.types.js'; describe('Client Types', () => { it('should allow function returning error', async () => { diff --git a/packages/davinci-client/src/lib/client.types.ts b/packages/davinci-client/src/lib/client.types.ts index 3dd3dbe849..09cf67437c 100644 --- a/packages/davinci-client/src/lib/client.types.ts +++ b/packages/davinci-client/src/lib/client.types.ts @@ -7,18 +7,18 @@ import type { GenericError } from '@forgerock/sdk-types'; import type { - FidoRegistrationInputValue, - FidoAuthenticationInputValue, - PhoneNumberInputValue, - PhoneNumberExtensionInputValue, AutoCollectors, + FidoAuthenticationInputValue, + FidoRegistrationInputValue, MultiValueCollectors, ObjectValueCollectors, - ValidatedTextCollector, + PhoneNumberExtensionInputValue, + PhoneNumberInputValue, ValidatedBooleanCollector, ValidatedPasswordCollector, + ValidatedTextCollector, } from './collector.types.js'; -import type { ErrorNode, FailureNode, ContinueNode, StartNode, SuccessNode } from './node.types.js'; +import type { ContinueNode, ErrorNode, FailureNode, StartNode, SuccessNode } from './node.types.js'; export type FlowNode = ContinueNode | ErrorNode | StartNode | SuccessNode | FailureNode; diff --git a/packages/davinci-client/src/lib/collector.types.test-d.ts b/packages/davinci-client/src/lib/collector.types.test-d.ts index e9576f2b19..83b26115fc 100644 --- a/packages/davinci-client/src/lib/collector.types.test-d.ts +++ b/packages/davinci-client/src/lib/collector.types.test-d.ts @@ -5,43 +5,44 @@ * of the MIT license. See the LICENSE file for details. */ import { describe, expectTypeOf, it } from 'vitest'; + import type { - SingleValueCollectorTypes, - SingleValueCollectorWithValue, - SingleValueCollectorNoValue, + ActionCollectorNoUrl, ActionCollectorTypes, ActionCollectorWithUrl, - ActionCollectorNoUrl, - TextCollector, - PasswordCollector, - ValidatedPasswordCollector, + AgreementCollector, + CollectorRichContent, FlowCollector, IdpCollector, - SubmitCollector, - SingleSelectCollector, - MultiValueCollectorWithValue, - MultiSelectCollector, - InferSingleValueCollectorType, - InferMultiValueCollectorType, InferActionCollectorType, + InferMultiValueCollectorType, InferNoValueCollectorType, - ReadOnlyCollector, - RichTextCollector, - QrCodeCollector, - AgreementCollector, + InferSingleValueCollectorType, + InferValueObjectCollectorType, + MultiSelectCollector, + MultiValueCollectorWithValue, + NoValueCollector, + ObjectValueCollectorWithObjectValue, + PasswordCollector, PhoneNumberCollector, PhoneNumberExtensionCollector, - ObjectValueCollectorWithObjectValue, - InferValueObjectCollectorType, - PhoneNumberInputValue, - PhoneNumberOutputValue, PhoneNumberExtensionInputValue, PhoneNumberExtensionOutputValue, + PhoneNumberInputValue, + PhoneNumberOutputValue, + QrCodeCollector, + ReadOnlyCollector, RichContentLink, - CollectorRichContent, - NoValueCollector, + RichTextCollector, + SingleSelectCollector, SingleSelectCollectorWithValue, + SingleValueCollectorNoValue, + SingleValueCollectorTypes, + SingleValueCollectorWithValue, + SubmitCollector, + TextCollector, ValidatedBooleanCollector, + ValidatedPasswordCollector, ValidatedTextCollector, } from './collector.types.js'; import type { PasswordPolicy } from './davinci.types.js'; diff --git a/packages/davinci-client/src/lib/collector.utils.test.ts b/packages/davinci-client/src/lib/collector.utils.test.ts index 1d890ac149..185133d36b 100644 --- a/packages/davinci-client/src/lib/collector.utils.test.ts +++ b/packages/davinci-client/src/lib/collector.utils.test.ts @@ -4,60 +4,62 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { + normalizeReplacements, returnActionCollector, + returnAgreementCollector, returnFlowCollector, returnIdpCollector, - returnSubmitCollector, - returnSingleValueCollector, - returnPasswordCollector, - returnValidatedPasswordCollector, - returnTextCollector, - returnSingleSelectCollector, returnMultiSelectCollector, - returnValidator, - returnReadOnlyCollector, returnNoValueCollector, returnObjectSelectCollector, - returnObjectValueCollector, - returnSingleValueAutoCollector, returnObjectValueAutoCollector, + returnObjectValueCollector, + returnPasswordCollector, returnQrCodeCollector, - returnAgreementCollector, - normalizeReplacements, + returnReadOnlyCollector, + returnSingleSelectCollector, + returnSingleValueAutoCollector, + returnSingleValueCollector, + returnSubmitCollector, + returnTextCollector, returnValidatedBooleanCollector, + returnValidatedPasswordCollector, + returnValidator, } from './collector.utils.js'; import { returnPasswordPolicyValidator } from './password-policy.rules.js'; + import type { + MultiSelectCollector, + PhoneNumberCollector, + PhoneNumberExtensionCollector, + PhoneNumberExtensionOutputValue, + PhoneNumberOutputValue, + RichTextCollector, + ValidatedBooleanCollector, + ValidatedTextCollector, +} from './collector.types.js'; +import type { + AgreementField, DaVinciField, DeviceAuthenticationField, DeviceRegistrationField, - PasswordField, FidoAuthenticationField, FidoRegistrationField, + PasswordField, PhoneNumberExtensionField, PhoneNumberField, + PollingField, ProtectField, QrCodeField, - PollingField, ReadOnlyField, RedirectField, RichContentReplacement, SingleCheckboxField, StandardField, - AgreementField, } from './davinci.types.js'; -import type { - MultiSelectCollector, - PhoneNumberCollector, - PhoneNumberExtensionCollector, - PhoneNumberOutputValue, - PhoneNumberExtensionOutputValue, - RichTextCollector, - ValidatedBooleanCollector, - ValidatedTextCollector, -} from './collector.types.js'; describe('Action Collectors', () => { describe('returnFlowCollector', () => { diff --git a/packages/davinci-client/src/lib/collector.utils.ts b/packages/davinci-client/src/lib/collector.utils.ts index 1215aa094e..ea96aab5e8 100644 --- a/packages/davinci-client/src/lib/collector.utils.ts +++ b/packages/davinci-client/src/lib/collector.utils.ts @@ -7,60 +7,60 @@ /** * Import the required types */ -import { CollectorValueType, Validator } from './client.types.js'; +import type { CollectorValueType, Validator } from './client.types.js'; import type { ActionCollectors, ActionCollectorTypes, - InferSingleValueCollectorType, - InferMultiValueCollectorType, - SingleValueCollectorTypes, - MultiValueCollectorTypes, + AgreementCollector, + AutoCollectors, InferActionCollectorType, - NoValueCollectorTypes, + InferAutoCollectorType, + InferMultiValueCollectorType, InferNoValueCollectorType, - ValidatedBooleanCollector, - ValidatedSingleValueCollectorWithValue, - ValidatedTextCollector, + InferSingleValueCollectorType, InferValueObjectCollectorType, - ObjectValueCollectorTypes, - UnknownCollector, - InferAutoCollectorType, - PhoneNumberOutputValue, MultiValueCollectors, - ObjectValueCollectors, - AutoCollectors, - SingleValueAutoCollectorTypes, + MultiValueCollectorTypes, + NoValueCollectorTypes, ObjectValueAutoCollectorTypes, + ObjectValueCollectors, + ObjectValueCollectorTypes, + PasswordCollector, + PhoneNumberExtensionOutputValue, + PhoneNumberOutputValue, QrCodeCollector, ReadOnlyCollector, - RichTextCollector, RichContentLink, - AgreementCollector, - PhoneNumberExtensionOutputValue, - PasswordCollector, + RichTextCollector, + SingleValueAutoCollectorTypes, + SingleValueCollectorTypes, + UnknownCollector, + ValidatedBooleanCollector, ValidatedPasswordCollector, + ValidatedSingleValueCollectorWithValue, + ValidatedTextCollector, } from './collector.types.js'; import type { + AgreementField, DeviceAuthenticationField, DeviceRegistrationField, FidoAuthenticationField, FidoRegistrationField, MultiSelectField, PasswordField, + PhoneNumberExtensionField, PhoneNumberField, + PollingField, ProtectField, QrCodeField, - PollingField, ReadOnlyField, + ReadOnlyFields, RedirectField, RichContentReplacement, SingleCheckboxField, SingleSelectField, StandardField, ValidatedField, - AgreementField, - ReadOnlyFields, - PhoneNumberExtensionField, } from './davinci.types.js'; /** diff --git a/packages/davinci-client/src/lib/config.slice.test.ts b/packages/davinci-client/src/lib/config.slice.test.ts index e3149453b9..9eb08dd9d4 100644 --- a/packages/davinci-client/src/lib/config.slice.test.ts +++ b/packages/davinci-client/src/lib/config.slice.test.ts @@ -4,7 +4,8 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { configSlice } from './config.slice.js'; describe('The config slice reducers', () => { diff --git a/packages/davinci-client/src/lib/config.slice.ts b/packages/davinci-client/src/lib/config.slice.ts index 4f0c89c6f5..d6a2ef77f3 100644 --- a/packages/davinci-client/src/lib/config.slice.ts +++ b/packages/davinci-client/src/lib/config.slice.ts @@ -14,7 +14,7 @@ import { createSlice, type PayloadAction } from '@reduxjs/toolkit'; * Import the types */ import type { InternalDaVinciConfig } from './config.types.js'; -import { Endpoints } from './wellknown.types.js'; +import type { Endpoints } from './wellknown.types.js'; /** * @const initialState - The initial state of the configuration slice diff --git a/packages/davinci-client/src/lib/config.types.test-d.ts b/packages/davinci-client/src/lib/config.types.test-d.ts index 6b5c1ba7d5..cf6ca3b363 100644 --- a/packages/davinci-client/src/lib/config.types.test-d.ts +++ b/packages/davinci-client/src/lib/config.types.test-d.ts @@ -5,9 +5,11 @@ * of the MIT license. See the LICENSE file for details. */ import { describe, expectTypeOf, it } from 'vitest'; -import type { DaVinciConfig, InternalDaVinciConfig } from './config.types.js'; + import type { AsyncLegacyConfigOptions, WellknownResponse } from '@forgerock/sdk-types'; +import type { DaVinciConfig, InternalDaVinciConfig } from './config.types.js'; + describe('Config Types', () => { describe('DaVinciConfig', () => { it('should extend AsyncLegacyConfigOptions', () => { diff --git a/packages/davinci-client/src/lib/davinci.api.ts b/packages/davinci-client/src/lib/davinci.api.ts index c8a1915dc4..cd880898c9 100644 --- a/packages/davinci-client/src/lib/davinci.api.ts +++ b/packages/davinci-client/src/lib/davinci.api.ts @@ -8,26 +8,25 @@ * Import the RTK Query library from Redux Toolkit * @see https://redux-toolkit.js.org/rtk-query/overview */ -import { - createApi, - FetchArgs, - fetchBaseQuery, - FetchBaseQueryError, - FetchBaseQueryMeta, - QueryReturnValue, -} from '@reduxjs/toolkit/query'; - +import { createAuthorizeUrl } from '@forgerock/sdk-oidc'; /** * Import internal modules */ import { initQuery } from '@forgerock/sdk-request-middleware'; -import { createAuthorizeUrl } from '@forgerock/sdk-oidc'; +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; import { handleResponse, transformActionRequest, transformSubmitRequest } from './davinci.utils.js'; import type { logger as loggerFn } from '@forgerock/sdk-logger'; import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; +import type { + FetchArgs, + FetchBaseQueryError, + FetchBaseQueryMeta, + QueryReturnValue, +} from '@reduxjs/toolkit/query'; +import type { StartNode } from '../types.js'; /** * Import the DaVinci types */ @@ -39,7 +38,6 @@ import type { ThrownQueryError, } from './davinci.types.js'; import type { ContinueNode } from './node.types.js'; -import type { StartNode } from '../types.js'; type BaseQueryResponse = Promise< QueryReturnValue diff --git a/packages/davinci-client/src/lib/davinci.utils.test.ts b/packages/davinci-client/src/lib/davinci.utils.test.ts index 094d4d945c..6016f37dbc 100644 --- a/packages/davinci-client/src/lib/davinci.utils.test.ts +++ b/packages/davinci-client/src/lib/davinci.utils.test.ts @@ -4,18 +4,17 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect, vi } from 'vitest'; - import { logger } from '@forgerock/sdk-logger'; +import { describe, expect, it, vi } from 'vitest'; -import { handleResponse, transformSubmitRequest, transformActionRequest } from './davinci.utils.js'; - -import type { ContinueNode } from './node.types.d.ts'; -import { next0 } from './mock-data/davinci.next.mock.js'; -import { DaVinciCacheEntry } from './davinci.types.js'; +import { handleResponse, transformActionRequest, transformSubmitRequest } from './davinci.utils.js'; import { error0a, error3 } from './mock-data/davinci.error.mock.js'; +import { next0 } from './mock-data/davinci.next.mock.js'; import { success0 } from './mock-data/davinci.success.mock.js'; +import type { DaVinciCacheEntry } from './davinci.types.js'; +import type { ContinueNode } from './node.types.d.ts'; + describe('transformSubmitRequest', () => { it('should transform node state to DaVinciRequest for next request', () => { const node: ContinueNode = { diff --git a/packages/davinci-client/src/lib/davinci.utils.ts b/packages/davinci-client/src/lib/davinci.utils.ts index f3271d1017..3edd0e4dc7 100644 --- a/packages/davinci-client/src/lib/davinci.utils.ts +++ b/packages/davinci-client/src/lib/davinci.utils.ts @@ -7,12 +7,17 @@ /** * Import the used types */ -import type { Dispatch } from '@reduxjs/toolkit'; - -import { logger as loggerFn } from '@forgerock/sdk-logger'; - import { nodeSlice } from './node.slice.js'; +import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { Dispatch } from '@reduxjs/toolkit'; + +import type { + DeviceValue, + FidoAuthenticationInputValue, + FidoRegistrationInputValue, + PhoneNumberInputValue, +} from './collector.types.js'; import type { DaVinciCacheEntry, DavinciErrorResponse, @@ -22,12 +27,6 @@ import type { DaVinciSuccessResponse, } from './davinci.types.js'; import type { ContinueNode } from './node.types.js'; -import { - DeviceValue, - FidoAuthenticationInputValue, - FidoRegistrationInputValue, - PhoneNumberInputValue, -} from './collector.types.js'; /** * @function transformSubmitRequest - Transforms a NextNode into a DaVinciRequest for form submissions * @param {ContinueNode} node - The node to transform into a DaVinciRequest diff --git a/packages/davinci-client/src/lib/fido/fido.ts b/packages/davinci-client/src/lib/fido/fido.ts index a48a9f63f9..2bde58e25c 100644 --- a/packages/davinci-client/src/lib/fido/fido.ts +++ b/packages/davinci-client/src/lib/fido/fido.ts @@ -6,6 +6,7 @@ */ import { Micro } from 'effect'; import { exitIsFail, exitIsSuccess } from 'effect/Micro'; + import { transformAssertion, transformAuthenticationOptions, @@ -14,6 +15,7 @@ import { } from './fido.utils.js'; import type { GenericError } from '@forgerock/sdk-types'; + import type { FidoAuthenticationInputValue, FidoRegistrationInputValue, diff --git a/packages/davinci-client/src/lib/fido/fido.utils.test.ts b/packages/davinci-client/src/lib/fido/fido.utils.test.ts index 5470cfeff1..67968dad57 100644 --- a/packages/davinci-client/src/lib/fido/fido.utils.test.ts +++ b/packages/davinci-client/src/lib/fido/fido.utils.test.ts @@ -4,7 +4,8 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { transformAssertion, transformAuthenticationOptions, @@ -12,8 +13,8 @@ import { transformRegistrationOptions, } from './fido.utils'; -import type { FidoAuthenticationOptions, FidoRegistrationOptions } from '../davinci.types'; import type { FidoAuthenticationInputValue, FidoRegistrationInputValue } from '../collector.types'; +import type { FidoAuthenticationOptions, FidoRegistrationOptions } from '../davinci.types'; function base64ToArrayBuffer(base64: string): ArrayBuffer { const binaryString = atob(base64); diff --git a/packages/davinci-client/src/lib/node.reducer.test.ts b/packages/davinci-client/src/lib/node.reducer.test.ts index d1fcc95655..9757814263 100644 --- a/packages/davinci-client/src/lib/node.reducer.test.ts +++ b/packages/davinci-client/src/lib/node.reducer.test.ts @@ -4,26 +4,27 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; import { nodeCollectorReducer } from './node.reducer.js'; + import type { + AgreementCollector, DeviceAuthenticationCollector, DeviceRegistrationCollector, FidoAuthenticationCollector, FidoRegistrationCollector, MultiSelectCollector, PasswordCollector, - ValidatedPasswordCollector, PhoneNumberCollector, PhoneNumberExtensionCollector, PollingCollector, ProtectCollector, QrCodeCollector, - AgreementCollector, SubmitCollector, TextCollector, ValidatedBooleanCollector, + ValidatedPasswordCollector, } from './collector.types.js'; import type { FidoAuthenticationOptions, FidoRegistrationOptions } from './davinci.types.js'; diff --git a/packages/davinci-client/src/lib/node.reducer.ts b/packages/davinci-client/src/lib/node.reducer.ts index 1dd74a6d53..048d2f456f 100644 --- a/packages/davinci-client/src/lib/node.reducer.ts +++ b/packages/davinci-client/src/lib/node.reducer.ts @@ -14,29 +14,30 @@ import { createAction, createReducer } from '@reduxjs/toolkit'; */ import { returnActionCollector, + returnAgreementCollector, + returnFidoAuthenticationCollector, + returnFidoRegistrationCollector, returnFlowCollector, - returnPasswordCollector, - returnValidatedPasswordCollector, returnIdpCollector, - returnSubmitCollector, - returnTextCollector, - returnValidatedBooleanCollector, - returnSingleSelectCollector, returnMultiSelectCollector, - returnReadOnlyCollector, returnObjectSelectCollector, returnObjectValueCollector, - returnProtectCollector, + returnPasswordCollector, returnPollingCollector, - returnUnknownCollector, - returnFidoRegistrationCollector, - returnFidoAuthenticationCollector, + returnProtectCollector, returnQrCodeCollector, - returnAgreementCollector, + returnReadOnlyCollector, + returnSingleSelectCollector, + returnSubmitCollector, + returnTextCollector, + returnUnknownCollector, + returnValidatedBooleanCollector, + returnValidatedPasswordCollector, } from './collector.utils.js'; -import type { DaVinciField, UnknownField } from './davinci.types.js'; -import type { PhoneNumberOutputValue, PhoneNumberExtensionOutputValue } from './collector.types.js'; + import type { CollectorValueTypes } from './client.types.js'; +import type { PhoneNumberExtensionOutputValue, PhoneNumberOutputValue } from './collector.types.js'; +import type { DaVinciField, UnknownField } from './davinci.types.js'; import type { Collectors } from './node.types.js'; /** diff --git a/packages/davinci-client/src/lib/node.slice.test.ts b/packages/davinci-client/src/lib/node.slice.test.ts index 6156dd8aca..e92f82f8b5 100644 --- a/packages/davinci-client/src/lib/node.slice.test.ts +++ b/packages/davinci-client/src/lib/node.slice.test.ts @@ -4,15 +4,16 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; -import { nodeSlice } from './node.slice.js'; +import { error0a, error2b, error3 } from './mock-data/davinci.error.mock.js'; import { next0 } from './mock-data/davinci.next.mock.js'; -import { nodeNext0 } from './mock-data/node.next.mock.js'; import { success0, success1 } from './mock-data/davinci.success.mock.js'; -import { nodeSuccess0, nodeSuccess1 } from './mock-data/node.success.mock.js'; -import { error0a, error2b, error3 } from './mock-data/davinci.error.mock.js'; +import { nodeNext0 } from './mock-data/node.next.mock.js'; import { continuePolling } from './mock-data/node.poll.mock.js'; +import { nodeSuccess0, nodeSuccess1 } from './mock-data/node.success.mock.js'; +import { nodeSlice } from './node.slice.js'; + import type { ContinueNode } from './node.types.js'; describe('The node slice reducers', () => { diff --git a/packages/davinci-client/src/lib/node.slice.ts b/packages/davinci-client/src/lib/node.slice.ts index 29d91342bd..8c4900761c 100644 --- a/packages/davinci-client/src/lib/node.slice.ts +++ b/packages/davinci-client/src/lib/node.slice.ts @@ -9,10 +9,7 @@ */ import { createSlice } from '@reduxjs/toolkit'; -/** - * Import the needed reducers - */ -import { nodeCollectorReducer, updateCollectorValues } from './node.reducer.js'; +import { nodeCollectorReducer } from './node.reducer.js'; import { getCollectorErrors } from './node.utils.js'; /** @@ -27,7 +24,11 @@ import type { DaVinciNextResponse, DaVinciSuccessResponse, } from './davinci.types.js'; -import type { ContinueNode, SuccessNode, ErrorNode, StartNode, FailureNode } from './node.types.js'; +/** + * Import the needed reducers + */ +import type { updateCollectorValues } from './node.reducer.js'; +import type { ContinueNode, ErrorNode, FailureNode, StartNode, SuccessNode } from './node.types.js'; /** * The possible statuses for the four types of nodes diff --git a/packages/davinci-client/src/lib/node.types.test-d.ts b/packages/davinci-client/src/lib/node.types.test-d.ts index cab5ce8e90..6d6882836a 100644 --- a/packages/davinci-client/src/lib/node.types.test-d.ts +++ b/packages/davinci-client/src/lib/node.types.test-d.ts @@ -6,43 +6,44 @@ */ /* eslint-disable @typescript-eslint/no-unused-vars */ import { describe, expectTypeOf, it } from 'vitest'; + import type { - DaVinciError, - Collectors, - ContinueNode, - ErrorNode, - FailureNode, - StartNode, - SuccessNode, -} from './node.types.js'; -import type { ErrorDetail, Links } from './davinci.types.js'; -import { ActionCollector, + AgreementCollector, + DeviceAuthenticationCollector, + DeviceRegistrationCollector, + FidoAuthenticationCollector, + FidoRegistrationCollector, FlowCollector, + IdpCollector, MultiSelectCollector, PasswordCollector, - ValidatedPasswordCollector, + PhoneNumberCollector, + PhoneNumberExtensionCollector, + PollingCollector, + ProtectCollector, + QrCodeCollector, ReadOnlyCollector, RichTextCollector, - ValidatedBooleanCollector, SingleSelectCollector, SingleValueCollector, - IdpCollector, SubmitCollector, TextCollector, - ValidatedTextCollector, - DeviceRegistrationCollector, - DeviceAuthenticationCollector, - PhoneNumberCollector, - PhoneNumberExtensionCollector, UnknownCollector, - ProtectCollector, - PollingCollector, - FidoRegistrationCollector, - FidoAuthenticationCollector, - QrCodeCollector, - AgreementCollector, + ValidatedBooleanCollector, + ValidatedPasswordCollector, + ValidatedTextCollector, } from './collector.types.js'; +import type { ErrorDetail, Links } from './davinci.types.js'; +import type { + Collectors, + ContinueNode, + DaVinciError, + ErrorNode, + FailureNode, + StartNode, + SuccessNode, +} from './node.types.js'; // ErrorDetail and Links are used as part of the DaVinciError and server._links types respectively describe('Node Types', () => { diff --git a/packages/davinci-client/src/lib/node.types.ts b/packages/davinci-client/src/lib/node.types.ts index 657feb5085..7ca1cbd46d 100644 --- a/packages/davinci-client/src/lib/node.types.ts +++ b/packages/davinci-client/src/lib/node.types.ts @@ -4,34 +4,34 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { GenericError } from '@forgerock/sdk-types'; +import type { GenericError } from '@forgerock/sdk-types'; import type { - FlowCollector, - PasswordCollector, - ValidatedPasswordCollector, - TextCollector, - IdpCollector, - SubmitCollector, ActionCollector, - ValidatedBooleanCollector, - SingleValueCollector, - SingleSelectCollector, - MultiSelectCollector, + AgreementCollector, DeviceAuthenticationCollector, DeviceRegistrationCollector, - ReadOnlyCollector, - RichTextCollector, - ValidatedTextCollector, + FidoAuthenticationCollector, + FidoRegistrationCollector, + FlowCollector, + IdpCollector, + MultiSelectCollector, + PasswordCollector, PhoneNumberCollector, - ProtectCollector, + PhoneNumberExtensionCollector, PollingCollector, - UnknownCollector, - FidoRegistrationCollector, - FidoAuthenticationCollector, + ProtectCollector, QrCodeCollector, - AgreementCollector, - PhoneNumberExtensionCollector, + ReadOnlyCollector, + RichTextCollector, + SingleSelectCollector, + SingleValueCollector, + SubmitCollector, + TextCollector, + UnknownCollector, + ValidatedBooleanCollector, + ValidatedPasswordCollector, + ValidatedTextCollector, } from './collector.types.js'; import type { Links } from './davinci.types.js'; diff --git a/packages/davinci-client/src/lib/node.utils.test.ts b/packages/davinci-client/src/lib/node.utils.test.ts index 7dd403f593..4ad9378203 100644 --- a/packages/davinci-client/src/lib/node.utils.test.ts +++ b/packages/davinci-client/src/lib/node.utils.test.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; import { error0a, error1a, error1b, error1c, error1f } from './mock-data/davinci.error.mock.js'; import { getCollectorErrors } from './node.utils.js'; diff --git a/packages/davinci-client/src/lib/node.utils.ts b/packages/davinci-client/src/lib/node.utils.ts index 4eee644f1a..d4a599975c 100644 --- a/packages/davinci-client/src/lib/node.utils.ts +++ b/packages/davinci-client/src/lib/node.utils.ts @@ -4,8 +4,8 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { DavinciErrorResponse } from './davinci.types.js'; -import { CollectorErrors } from './node.types.js'; +import type { DavinciErrorResponse } from './davinci.types.js'; +import type { CollectorErrors } from './node.types.js'; export function getCollectorErrors(error: DavinciErrorResponse) { const details = error.details; diff --git a/packages/davinci-client/src/lib/password-policy.rules.ts b/packages/davinci-client/src/lib/password-policy.rules.ts index 2d6f517fe5..3c237c74ed 100644 --- a/packages/davinci-client/src/lib/password-policy.rules.ts +++ b/packages/davinci-client/src/lib/password-policy.rules.ts @@ -6,9 +6,9 @@ */ import { Array as Arr, Option, pipe } from 'effect'; +import type { Validator } from './client.types.js'; import type { ValidatedPasswordCollector } from './collector.types.js'; import type { PasswordPolicy } from './davinci.types.js'; -import { Validator } from './client.types.js'; /** * A single policy check: given the policy and a candidate value, produce zero or more diff --git a/packages/davinci-client/src/lib/wellknown.api.ts b/packages/davinci-client/src/lib/wellknown.api.ts index 251d24a04d..0cf6b300b3 100644 --- a/packages/davinci-client/src/lib/wellknown.api.ts +++ b/packages/davinci-client/src/lib/wellknown.api.ts @@ -5,9 +5,9 @@ * of the MIT license. See the LICENSE file for details. */ +import { initWellknownQuery } from '@forgerock/sdk-oidc'; import { createSelector } from '@reduxjs/toolkit'; import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; -import { initWellknownQuery } from '@forgerock/sdk-oidc'; import type { WellknownResponse } from '@forgerock/sdk-types'; import type { diff --git a/packages/davinci-client/src/types.test-d.ts b/packages/davinci-client/src/types.test-d.ts index 8cf841a0ea..cd14898dd7 100644 --- a/packages/davinci-client/src/types.test-d.ts +++ b/packages/davinci-client/src/types.test-d.ts @@ -6,23 +6,24 @@ */ /* eslint-disable @typescript-eslint/no-unused-vars */ import { describe, expectTypeOf, it } from 'vitest'; + +import type { NodeStates } from './lib/client.types.js'; +import type { DaVinciError } from './lib/node.types.js'; +import type * as Types from './types.js'; import type { - StartNode, + ActionCollector, ContinueNode, ErrorNode, - SuccessNode, FailureNode, - ActionCollector, - SingleValueCollector, FlowCollector, - PasswordCollector, - TextCollector, IdpCollector, + PasswordCollector, + SingleValueCollector, + StartNode, SubmitCollector, + SuccessNode, + TextCollector, } from './types.js'; -import type * as Types from './types.js'; -import { DaVinciError } from './lib/node.types.js'; -import { NodeStates } from './lib/client.types.js'; describe('Type exports', () => { it('should validate all types are exported', () => { diff --git a/packages/davinci-client/src/types.ts b/packages/davinci-client/src/types.ts index eef29fda63..1db0ea26c9 100644 --- a/packages/davinci-client/src/types.ts +++ b/packages/davinci-client/src/types.ts @@ -36,7 +36,14 @@ export { // Re-export the davinci function so DavinciClient type alias can be resolved export { davinci } from './lib/client.store.js'; -import { davinci } from './lib/client.store.js'; +import type { davinci } from './lib/client.store.js'; +import type { + ContinueNode, + ErrorNode, + FailureNode, + StartNode, + SuccessNode, +} from './lib/node.types.js'; export type DavinciClient = Awaited>; @@ -45,8 +52,8 @@ export type DavinciClient = Awaited>; * Represents the parsed client-facing state from a DaVinci flow node. */ export type GetClient = - | import('./lib/node.types.js').StartNode['client'] - | import('./lib/node.types.js').ContinueNode['client'] - | import('./lib/node.types.js').ErrorNode['client'] - | import('./lib/node.types.js').SuccessNode['client'] - | import('./lib/node.types.js').FailureNode['client']; + | StartNode['client'] + | ContinueNode['client'] + | ErrorNode['client'] + | SuccessNode['client'] + | FailureNode['client']; diff --git a/packages/device-client/src/lib/device.store.test.ts b/packages/device-client/src/lib/device.store.test.ts index 4e006874d1..7cd00688f2 100644 --- a/packages/device-client/src/lib/device.store.test.ts +++ b/packages/device-client/src/lib/device.store.test.ts @@ -5,17 +5,17 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { afterEach, afterAll, beforeAll, describe, expect, it } from 'vitest'; import { setupServer } from 'msw/node'; +import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; + import { deviceClient } from './device.store.js'; import { handlers } from './device.store.test.utils.js'; - import { - MOCK_PUSH_DEVICES, MOCK_BINDING_DEVICES, + MOCK_DEVICE_PROFILE_SUCCESS, MOCK_OATH_DEVICES, + MOCK_PUSH_DEVICES, MOCK_WEBAUTHN_DEVICES, - MOCK_DEVICE_PROFILE_SUCCESS, } from './mock-data/device.store.mock.js'; export const server = setupServer(...handlers); diff --git a/packages/device-client/src/lib/device.store.test.utils.ts b/packages/device-client/src/lib/device.store.test.utils.ts index 32e9c3a08a..b7820fb5e4 100644 --- a/packages/device-client/src/lib/device.store.test.utils.ts +++ b/packages/device-client/src/lib/device.store.test.utils.ts @@ -8,12 +8,12 @@ import { http, HttpResponse } from 'msw'; import { - MOCK_PUSH_DEVICES, MOCK_BINDING_DEVICES, - MOCK_OATH_DEVICES, MOCK_DELETED_OATH_DEVICE, - MOCK_WEBAUTHN_DEVICES, MOCK_DEVICE_PROFILE_SUCCESS, + MOCK_OATH_DEVICES, + MOCK_PUSH_DEVICES, + MOCK_WEBAUTHN_DEVICES, } from './mock-data/device.store.mock.js'; // Create mock service worker handlers diff --git a/packages/device-client/src/lib/device.store.ts b/packages/device-client/src/lib/device.store.ts index 8b18f5ac6f..391fdd2732 100644 --- a/packages/device-client/src/lib/device.store.ts +++ b/packages/device-client/src/lib/device.store.ts @@ -6,21 +6,23 @@ */ import { type ConfigOptions } from '@forgerock/javascript-sdk'; import { configureStore } from '@reduxjs/toolkit'; + +import { handleError } from './device.store.utils.js'; import { deviceService } from './services/index.js'; + +import type { BoundDeviceQuery, Device, GetBoundDevicesQuery } from './types/bound-device.types.js'; import type { OathDevice, RetrieveOathQuery } from './types/oath.types.js'; +import type { + GetProfileDevices, + ProfileDevice, + ProfileDevicesQuery, +} from './types/profile-device.types.js'; import type { DeleteDeviceQuery, PushDevice, PushDeviceQuery } from './types/push-device.types.js'; import type { UpdatedWebAuthnDevice, WebAuthnDevice, WebAuthnQuery, } from './types/webauthn.types.js'; -import type { BoundDeviceQuery, Device, GetBoundDevicesQuery } from './types/bound-device.types.js'; -import type { - GetProfileDevices, - ProfileDevice, - ProfileDevicesQuery, -} from './types/profile-device.types.js'; -import { handleError } from './device.store.utils.js'; /** * @function deviceClient diff --git a/packages/device-client/src/lib/device.store.utils.ts b/packages/device-client/src/lib/device.store.utils.ts index 7e62f5e0c2..0fb813aec5 100644 --- a/packages/device-client/src/lib/device.store.utils.ts +++ b/packages/device-client/src/lib/device.store.utils.ts @@ -1,5 +1,5 @@ -import { SerializedError } from '@reduxjs/toolkit'; -import { FetchBaseQueryError } from '@reduxjs/toolkit/query'; +import type { SerializedError } from '@reduxjs/toolkit'; +import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; export function handleError(error: FetchBaseQueryError | SerializedError, message?: string) { /** diff --git a/packages/device-client/src/lib/mock-data/device.store.mock.ts b/packages/device-client/src/lib/mock-data/device.store.mock.ts index 3c53c7bfd8..8348feef3e 100644 --- a/packages/device-client/src/lib/mock-data/device.store.mock.ts +++ b/packages/device-client/src/lib/mock-data/device.store.mock.ts @@ -4,11 +4,11 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { GeneralResponse } from '../services/index.js'; +import type { GeneralResponse } from '../services/index.js'; import type { - OathResponse, DeletedOathDevice, DeviceResponse, + OathResponse, ProfileDevice, PushDevice, WebAuthnDevice, diff --git a/packages/device-client/src/lib/services/index.ts b/packages/device-client/src/lib/services/index.ts index fd7be4981d..5215e993dc 100644 --- a/packages/device-client/src/lib/services/index.ts +++ b/packages/device-client/src/lib/services/index.ts @@ -5,26 +5,34 @@ * of the MIT license. See the LICENSE file for details. */ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; -import { + +import type { + BoundDeviceQuery, + Device, + GetBoundDevicesQuery, +} from '../types/bound-device.types.js'; +import type { DeletedOathDevice, OathDevice, OathResponse, RetrieveOathQuery, } from '../types/oath.types.js'; -import { +import type { + GetProfileDevices, + ProfileDevice, + ProfileDevicesQuery, +} from '../types/profile-device.types.js'; +import type { DeleteDeviceQuery, DeletedPushDevice, PushDevice, PushDeviceQuery, } from '../types/push-device.types.js'; -import { BoundDeviceQuery, Device, GetBoundDevicesQuery } from '../types/bound-device.types.js'; - -import { UpdatedWebAuthnDevice, WebAuthnDevice, WebAuthnQuery } from '../types/webauthn.types.js'; -import { - ProfileDevice, - GetProfileDevices, - ProfileDevicesQuery, -} from '../types/profile-device.types.js'; +import type { + UpdatedWebAuthnDevice, + WebAuthnDevice, + WebAuthnQuery, +} from '../types/webauthn.types.js'; export interface GeneralResponse { pagedResultsCookie: string | null; diff --git a/packages/device-client/src/lib/types/index.ts b/packages/device-client/src/lib/types/index.ts index 884c2a1d05..2ce5b75089 100644 --- a/packages/device-client/src/lib/types/index.ts +++ b/packages/device-client/src/lib/types/index.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { deviceClient } from '../device.store.js'; +import type { deviceClient } from '../device.store.js'; export type DeviceClient = ReturnType; diff --git a/packages/journey-client/src/__tests__/types-reexport.typecheck.ts b/packages/journey-client/src/__tests__/types-reexport.typecheck.ts index 136becfe45..502b92d71f 100644 --- a/packages/journey-client/src/__tests__/types-reexport.typecheck.ts +++ b/packages/journey-client/src/__tests__/types-reexport.typecheck.ts @@ -2,29 +2,29 @@ * Verifies consumer-facing types are re-exported from @forgerock/journey-client/types. * Checked by tsc --noEmit, not executed at runtime. */ +// PolicyKey is a value (enum), verify it is available from main index +import { PolicyKey } from '../index.js'; + import type { - // Already re-exported (regression guard) - Step, + ActionTypes, + AuthResponse, Callback, CallbackType, - StepType, - GenericError, - PolicyRequirement, + CustomLogger, FailedPolicyRequirement, + FailureDetail, + GenericError, LogLevel, - CustomLogger, - RequestMiddleware, - ActionTypes, // These should be re-exported but are not yet NameValue, + PolicyRequirement, + RequestMiddleware, + // Already re-exported (regression guard) + Step, StepDetail, - AuthResponse, - FailureDetail, + StepType, } from '../types.js'; -// PolicyKey is a value (enum), verify it is available from main index -import { PolicyKey } from '../index.js'; - // eslint-disable-next-line @typescript-eslint/no-unused-vars type _TypeAssert = [ Step, diff --git a/packages/journey-client/src/lib/callbacks/attribute-input-callback.test.ts b/packages/journey-client/src/lib/callbacks/attribute-input-callback.test.ts index d39f203cb5..ee3395af9c 100644 --- a/packages/journey-client/src/lib/callbacks/attribute-input-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/attribute-input-callback.test.ts @@ -10,10 +10,10 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - import { AttributeInputCallback } from './attribute-input-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('AttributeInputCallback', () => { const payload: Callback = { _id: 0, diff --git a/packages/journey-client/src/lib/callbacks/attribute-input-callback.ts b/packages/journey-client/src/lib/callbacks/attribute-input-callback.ts index 9977b1d9f8..48cc1a9036 100644 --- a/packages/journey-client/src/lib/callbacks/attribute-input-callback.ts +++ b/packages/journey-client/src/lib/callbacks/attribute-input-callback.ts @@ -5,10 +5,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect attributes. * diff --git a/packages/journey-client/src/lib/callbacks/base-callback.test.ts b/packages/journey-client/src/lib/callbacks/base-callback.test.ts index 35a0da5cb3..07ea7004ed 100644 --- a/packages/journey-client/src/lib/callbacks/base-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/base-callback.test.ts @@ -10,10 +10,10 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('BaseCallback', () => { it('reads/writes basic properties', () => { const payload: Callback = { diff --git a/packages/journey-client/src/lib/callbacks/base-callback.ts b/packages/journey-client/src/lib/callbacks/base-callback.ts index 16eb5fc168..6ab2166c62 100644 --- a/packages/journey-client/src/lib/callbacks/base-callback.ts +++ b/packages/journey-client/src/lib/callbacks/base-callback.ts @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -import type { CallbackType, Callback, NameValue } from '@forgerock/sdk-types'; +import type { Callback, CallbackType, NameValue } from '@forgerock/sdk-types'; /** * Base class for authentication tree callback wrappers. diff --git a/packages/journey-client/src/lib/callbacks/choice-callback.test.ts b/packages/journey-client/src/lib/callbacks/choice-callback.test.ts index 89397b0171..ef025e884b 100644 --- a/packages/journey-client/src/lib/callbacks/choice-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/choice-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { ChoiceCallback } from './choice-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('ChoiceCallback', () => { const payload: Callback = { type: callbackType.ChoiceCallback, diff --git a/packages/journey-client/src/lib/callbacks/choice-callback.ts b/packages/journey-client/src/lib/callbacks/choice-callback.ts index 2769f6fcec..ad9a0ed7d3 100644 --- a/packages/journey-client/src/lib/callbacks/choice-callback.ts +++ b/packages/journey-client/src/lib/callbacks/choice-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect an answer to a choice. */ diff --git a/packages/journey-client/src/lib/callbacks/confirmation-callback.test.ts b/packages/journey-client/src/lib/callbacks/confirmation-callback.test.ts index b93df5ac8f..b83f36e248 100644 --- a/packages/journey-client/src/lib/callbacks/confirmation-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/confirmation-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { ConfirmationCallback } from './confirmation-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('ConfirmationCallback', () => { const payload: Callback = { type: callbackType.ConfirmationCallback, diff --git a/packages/journey-client/src/lib/callbacks/confirmation-callback.ts b/packages/journey-client/src/lib/callbacks/confirmation-callback.ts index baeadfb078..407869574d 100644 --- a/packages/journey-client/src/lib/callbacks/confirmation-callback.ts +++ b/packages/journey-client/src/lib/callbacks/confirmation-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect a confirmation to a message. */ diff --git a/packages/journey-client/src/lib/callbacks/device-profile-callback.test.ts b/packages/journey-client/src/lib/callbacks/device-profile-callback.test.ts index 3792447ec8..45f440b4d1 100644 --- a/packages/journey-client/src/lib/callbacks/device-profile-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/device-profile-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { DeviceProfileCallback } from './device-profile-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('DeviceProfileCallback', () => { const payload: Callback = { type: callbackType.DeviceProfileCallback, diff --git a/packages/journey-client/src/lib/callbacks/device-profile-callback.ts b/packages/journey-client/src/lib/callbacks/device-profile-callback.ts index 78beeb1a19..a1a6ec0a19 100644 --- a/packages/journey-client/src/lib/callbacks/device-profile-callback.ts +++ b/packages/journey-client/src/lib/callbacks/device-profile-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + import type { DeviceProfileData } from '../device/interfaces.js'; /** diff --git a/packages/journey-client/src/lib/callbacks/factory.test.ts b/packages/journey-client/src/lib/callbacks/factory.test.ts index ee178e5264..6b41e3cee3 100644 --- a/packages/journey-client/src/lib/callbacks/factory.test.ts +++ b/packages/journey-client/src/lib/callbacks/factory.test.ts @@ -6,18 +6,15 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; - -import { createCallback } from './factory.js'; -import { BaseCallback } from './base-callback.js'; +import { describe, expect, it } from 'vitest'; // Import all callback classes to check against import { AttributeInputCallback } from './attribute-input-callback.js'; +import { BaseCallback } from './base-callback.js'; import { ChoiceCallback } from './choice-callback.js'; import { ConfirmationCallback } from './confirmation-callback.js'; import { DeviceProfileCallback } from './device-profile-callback.js'; +import { createCallback } from './factory.js'; import { HiddenValueCallback } from './hidden-value-callback.js'; import { KbaCreateCallback } from './kba-create-callback.js'; import { MetadataCallback } from './metadata-callback.js'; @@ -37,6 +34,8 @@ import { TextOutputCallback } from './text-output-callback.js'; import { ValidatedCreatePasswordCallback } from './validated-create-password-callback.js'; import { ValidatedCreateUsernameCallback } from './validated-create-username-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('Callback Factory', () => { const testCases = [ { type: callbackType.BooleanAttributeInputCallback, class: AttributeInputCallback }, diff --git a/packages/journey-client/src/lib/callbacks/factory.ts b/packages/journey-client/src/lib/callbacks/factory.ts index 9eaae7d039..23a4ff8d84 100644 --- a/packages/journey-client/src/lib/callbacks/factory.ts +++ b/packages/journey-client/src/lib/callbacks/factory.ts @@ -7,11 +7,8 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - -import { BaseCallback } from './base-callback.js'; - import { AttributeInputCallback } from './attribute-input-callback.js'; +import { BaseCallback } from './base-callback.js'; import { ChoiceCallback } from './choice-callback.js'; import { ConfirmationCallback } from './confirmation-callback.js'; import { DeviceProfileCallback } from './device-profile-callback.js'; @@ -34,6 +31,8 @@ import { TextOutputCallback } from './text-output-callback.js'; import { ValidatedCreatePasswordCallback } from './validated-create-password-callback.js'; import { ValidatedCreateUsernameCallback } from './validated-create-username-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + export type CallbackFactory = (callback: Callback) => BaseCallback; /** diff --git a/packages/journey-client/src/lib/callbacks/hidden-value-callback.test.ts b/packages/journey-client/src/lib/callbacks/hidden-value-callback.test.ts index 199a55d4e4..f69ea8426f 100644 --- a/packages/journey-client/src/lib/callbacks/hidden-value-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/hidden-value-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { HiddenValueCallback } from './hidden-value-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('HiddenValueCallback', () => { it('should instantiate correctly', () => { const payload: Callback = { diff --git a/packages/journey-client/src/lib/callbacks/hidden-value-callback.ts b/packages/journey-client/src/lib/callbacks/hidden-value-callback.ts index deaa2fb7f8..7fa27819b2 100644 --- a/packages/journey-client/src/lib/callbacks/hidden-value-callback.ts +++ b/packages/journey-client/src/lib/callbacks/hidden-value-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect information indirectly from the user. */ diff --git a/packages/journey-client/src/lib/callbacks/kba-create-callback.test.ts b/packages/journey-client/src/lib/callbacks/kba-create-callback.test.ts index 3ac9b45e1c..5d8c313550 100644 --- a/packages/journey-client/src/lib/callbacks/kba-create-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/kba-create-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { KbaCreateCallback } from './kba-create-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('KbaCreateCallback', () => { const payload: Callback = { type: callbackType.KbaCreateCallback, diff --git a/packages/journey-client/src/lib/callbacks/kba-create-callback.ts b/packages/journey-client/src/lib/callbacks/kba-create-callback.ts index d98d34302f..544771295e 100644 --- a/packages/journey-client/src/lib/callbacks/kba-create-callback.ts +++ b/packages/journey-client/src/lib/callbacks/kba-create-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect KBA-style security questions and answers. */ diff --git a/packages/journey-client/src/lib/callbacks/metadata-callback.test.ts b/packages/journey-client/src/lib/callbacks/metadata-callback.test.ts index 18932508a5..047b7b1818 100644 --- a/packages/journey-client/src/lib/callbacks/metadata-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/metadata-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { MetadataCallback } from './metadata-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('MetadataCallback', () => { it('should allow getting the data', () => { const mockData = { foo: 'bar', baz: 123 }; diff --git a/packages/journey-client/src/lib/callbacks/metadata-callback.ts b/packages/journey-client/src/lib/callbacks/metadata-callback.ts index 55abdc7360..2df225edac 100644 --- a/packages/journey-client/src/lib/callbacks/metadata-callback.ts +++ b/packages/journey-client/src/lib/callbacks/metadata-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to deliver and collect miscellaneous data. */ diff --git a/packages/journey-client/src/lib/callbacks/name-callback.test.ts b/packages/journey-client/src/lib/callbacks/name-callback.test.ts index 5c9dbe2e12..97259ecad1 100644 --- a/packages/journey-client/src/lib/callbacks/name-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/name-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { NameCallback } from './name-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('NameCallback', () => { const payload: Callback = { type: callbackType.NameCallback, diff --git a/packages/journey-client/src/lib/callbacks/name-callback.ts b/packages/journey-client/src/lib/callbacks/name-callback.ts index dd8e5a36ad..d36e6ef20e 100644 --- a/packages/journey-client/src/lib/callbacks/name-callback.ts +++ b/packages/journey-client/src/lib/callbacks/name-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect a username. */ diff --git a/packages/journey-client/src/lib/callbacks/password-callback.test.ts b/packages/journey-client/src/lib/callbacks/password-callback.test.ts index 2cba416a41..718441e17c 100644 --- a/packages/journey-client/src/lib/callbacks/password-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/password-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { PasswordCallback } from './password-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('PasswordCallback', () => { const payload: Callback = { type: callbackType.PasswordCallback, diff --git a/packages/journey-client/src/lib/callbacks/password-callback.ts b/packages/journey-client/src/lib/callbacks/password-callback.ts index dc264ec90d..e016a8d0db 100644 --- a/packages/journey-client/src/lib/callbacks/password-callback.ts +++ b/packages/journey-client/src/lib/callbacks/password-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect a password. */ diff --git a/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.test.ts b/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.test.ts index 564032de62..5f1ee4f2b9 100644 --- a/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.test.ts @@ -9,7 +9,7 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { vi, describe, it, expect } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { PingOneProtectEvaluationCallback } from './ping-protect-evaluation-callback.js'; diff --git a/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.ts b/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.ts index a3ea0cf79b..68911dcd76 100644 --- a/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.ts +++ b/packages/journey-client/src/lib/callbacks/ping-protect-evaluation-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * @class - Represents a callback used to complete and package up device and behavioral data. */ diff --git a/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.test.ts b/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.test.ts index 58d774e798..a36b79a766 100644 --- a/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.test.ts @@ -9,7 +9,7 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { vi, describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { PingOneProtectInitializeCallback } from './ping-protect-initialize-callback.js'; diff --git a/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.ts b/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.ts index 4e5d99018f..1c497c1610 100644 --- a/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.ts +++ b/packages/journey-client/src/lib/callbacks/ping-protect-initialize-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * @class - Represents a callback used to initialize and start device and behavioral data collection. */ diff --git a/packages/journey-client/src/lib/callbacks/polling-wait-callback.test.ts b/packages/journey-client/src/lib/callbacks/polling-wait-callback.test.ts index 03c1ee1fba..8acfe27da8 100644 --- a/packages/journey-client/src/lib/callbacks/polling-wait-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/polling-wait-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { PollingWaitCallback } from './polling-wait-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('PollingWaitCallback', () => { const payload: Callback = { type: callbackType.PollingWaitCallback, diff --git a/packages/journey-client/src/lib/callbacks/polling-wait-callback.ts b/packages/journey-client/src/lib/callbacks/polling-wait-callback.ts index 50ceb030a3..4e48d8a9d2 100644 --- a/packages/journey-client/src/lib/callbacks/polling-wait-callback.ts +++ b/packages/journey-client/src/lib/callbacks/polling-wait-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to instruct the system to poll while a backend process completes. */ diff --git a/packages/journey-client/src/lib/callbacks/recaptcha-callback.test.ts b/packages/journey-client/src/lib/callbacks/recaptcha-callback.test.ts index f5ec9fdaa3..64faf604b0 100644 --- a/packages/journey-client/src/lib/callbacks/recaptcha-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/recaptcha-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { ReCaptchaCallback } from './recaptcha-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('ReCaptchaCallback', () => { const payload: Callback = { type: callbackType.ReCaptchaCallback, diff --git a/packages/journey-client/src/lib/callbacks/recaptcha-callback.ts b/packages/journey-client/src/lib/callbacks/recaptcha-callback.ts index f2d2fbe8c6..5877ad9986 100644 --- a/packages/journey-client/src/lib/callbacks/recaptcha-callback.ts +++ b/packages/journey-client/src/lib/callbacks/recaptcha-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to integrate reCAPTCHA. */ diff --git a/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.test.ts b/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.test.ts index 950dd1a688..8690aa83da 100644 --- a/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.test.ts @@ -9,12 +9,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, expect, it, beforeAll } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { beforeAll, describe, expect, it } from 'vitest'; import { ReCaptchaEnterpriseCallback } from './recaptcha-enterprise-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + const recaptchaCallback: Callback = { type: callbackType.ReCaptchaEnterpriseCallback, output: [ diff --git a/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.ts b/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.ts index 07eb1ab539..c3125bc581 100644 --- a/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.ts +++ b/packages/journey-client/src/lib/callbacks/recaptcha-enterprise-callback.ts @@ -8,10 +8,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to integrate reCAPTCHA. */ diff --git a/packages/journey-client/src/lib/callbacks/redirect-callback.test.ts b/packages/journey-client/src/lib/callbacks/redirect-callback.test.ts index 31f7ec3d1e..f2a7425140 100644 --- a/packages/journey-client/src/lib/callbacks/redirect-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/redirect-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { RedirectCallback } from './redirect-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('RedirectCallback', () => { const payload: Callback = { type: callbackType.RedirectCallback, diff --git a/packages/journey-client/src/lib/callbacks/redirect-callback.ts b/packages/journey-client/src/lib/callbacks/redirect-callback.ts index 37c48dd2e6..0f88b06002 100644 --- a/packages/journey-client/src/lib/callbacks/redirect-callback.ts +++ b/packages/journey-client/src/lib/callbacks/redirect-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect an answer to a choice. */ diff --git a/packages/journey-client/src/lib/callbacks/select-idp-callback.test.ts b/packages/journey-client/src/lib/callbacks/select-idp-callback.test.ts index eeea3569a0..95a88022b4 100644 --- a/packages/journey-client/src/lib/callbacks/select-idp-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/select-idp-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { SelectIdPCallback } from './select-idp-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('SelectIdPCallback', () => { const payload: Callback = { type: callbackType.SelectIdPCallback, diff --git a/packages/journey-client/src/lib/callbacks/select-idp-callback.ts b/packages/journey-client/src/lib/callbacks/select-idp-callback.ts index 47cf23f2a5..6821b0aac1 100644 --- a/packages/journey-client/src/lib/callbacks/select-idp-callback.ts +++ b/packages/journey-client/src/lib/callbacks/select-idp-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + interface IdPValue { provider: string; uiConfig: { diff --git a/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.test.ts b/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.test.ts index 80abcc6033..bdf15855cd 100644 --- a/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { SuspendedTextOutputCallback } from './suspended-text-output-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('SuspendedTextOutputCallback', () => { it('should instantiate correctly and inherit from TextOutputCallback', () => { const payload: Callback = { diff --git a/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.ts b/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.ts index 79654dff51..34b5321a11 100644 --- a/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.ts +++ b/packages/journey-client/src/lib/callbacks/suspended-text-output-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { TextOutputCallback } from './text-output-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to display a message. */ diff --git a/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.test.ts b/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.test.ts index c6f9f6de87..1d18014c9a 100644 --- a/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { TermsAndConditionsCallback } from './terms-and-conditions-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('TermsAndConditionsCallback', () => { const date = new Date().toString(); const payload: Callback = { diff --git a/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.ts b/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.ts index 66e8d5e15e..90e9a2594b 100644 --- a/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.ts +++ b/packages/journey-client/src/lib/callbacks/terms-and-conditions-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect acceptance of terms and conditions. */ diff --git a/packages/journey-client/src/lib/callbacks/text-input-callback.test.ts b/packages/journey-client/src/lib/callbacks/text-input-callback.test.ts index 947ac6ab76..e051da165f 100644 --- a/packages/journey-client/src/lib/callbacks/text-input-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/text-input-callback.test.ts @@ -10,10 +10,10 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - import { TextInputCallback } from './text-input-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('TextInputCallback', () => { const payload: Callback = { type: callbackType.TextInputCallback, diff --git a/packages/journey-client/src/lib/callbacks/text-input-callback.ts b/packages/journey-client/src/lib/callbacks/text-input-callback.ts index d60233b718..fed1313863 100644 --- a/packages/journey-client/src/lib/callbacks/text-input-callback.ts +++ b/packages/journey-client/src/lib/callbacks/text-input-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to retrieve input from the user. */ diff --git a/packages/journey-client/src/lib/callbacks/text-output-callback.test.ts b/packages/journey-client/src/lib/callbacks/text-output-callback.test.ts index 29bacb7984..96cb959500 100644 --- a/packages/journey-client/src/lib/callbacks/text-output-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/text-output-callback.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; - -import type { Callback } from '@forgerock/sdk-types'; +import { describe, expect, it } from 'vitest'; import { TextOutputCallback } from './text-output-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('TextOutputCallback', () => { const payload: Callback = { type: callbackType.TextOutputCallback, diff --git a/packages/journey-client/src/lib/callbacks/text-output-callback.ts b/packages/journey-client/src/lib/callbacks/text-output-callback.ts index d1647af101..a6714e63be 100644 --- a/packages/journey-client/src/lib/callbacks/text-output-callback.ts +++ b/packages/journey-client/src/lib/callbacks/text-output-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + /** * Represents a callback used to display a message. */ diff --git a/packages/journey-client/src/lib/callbacks/validated-create-password-callback.test.ts b/packages/journey-client/src/lib/callbacks/validated-create-password-callback.test.ts index ec370ab701..8ec317d154 100644 --- a/packages/journey-client/src/lib/callbacks/validated-create-password-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/validated-create-password-callback.test.ts @@ -10,10 +10,10 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - import { ValidatedCreatePasswordCallback } from './validated-create-password-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('ValidatedCreatePasswordCallback', () => { const payload: Callback = { type: callbackType.ValidatedCreatePasswordCallback, diff --git a/packages/journey-client/src/lib/callbacks/validated-create-password-callback.ts b/packages/journey-client/src/lib/callbacks/validated-create-password-callback.ts index 31532363cf..ef863ecb46 100644 --- a/packages/journey-client/src/lib/callbacks/validated-create-password-callback.ts +++ b/packages/journey-client/src/lib/callbacks/validated-create-password-callback.ts @@ -4,10 +4,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect a valid platform password. */ diff --git a/packages/journey-client/src/lib/callbacks/validated-create-username-callback.test.ts b/packages/journey-client/src/lib/callbacks/validated-create-username-callback.test.ts index 8c7674deaf..9da99b166b 100644 --- a/packages/journey-client/src/lib/callbacks/validated-create-username-callback.test.ts +++ b/packages/journey-client/src/lib/callbacks/validated-create-username-callback.test.ts @@ -10,10 +10,10 @@ import { callbackType } from '@forgerock/sdk-types'; -import type { Callback } from '@forgerock/sdk-types'; - import { ValidatedCreateUsernameCallback } from './validated-create-username-callback.js'; +import type { Callback } from '@forgerock/sdk-types'; + describe('ValidatedCreateUsernameCallback', () => { const payload: Callback = { type: callbackType.ValidatedCreateUsernameCallback, diff --git a/packages/journey-client/src/lib/callbacks/validated-create-username-callback.ts b/packages/journey-client/src/lib/callbacks/validated-create-username-callback.ts index ec41bed146..e824ffd62e 100644 --- a/packages/journey-client/src/lib/callbacks/validated-create-username-callback.ts +++ b/packages/journey-client/src/lib/callbacks/validated-create-username-callback.ts @@ -5,10 +5,10 @@ * of the MIT license. See the LICENSE file for details. */ -import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; - import { BaseCallback } from './base-callback.js'; +import type { Callback, PolicyRequirement } from '@forgerock/sdk-types'; + /** * Represents a callback used to collect a valid platform username. */ diff --git a/packages/journey-client/src/lib/client.store.test.ts b/packages/journey-client/src/lib/client.store.test.ts index 180188c6bc..56aee05594 100644 --- a/packages/journey-client/src/lib/client.store.test.ts +++ b/packages/journey-client/src/lib/client.store.test.ts @@ -9,11 +9,12 @@ import { callbackType } from '@forgerock/sdk-types'; import { afterEach, describe, expect, test, vi } from 'vitest'; -import type { GenericError, Step, WellknownResponse } from '@forgerock/sdk-types'; - import { journey } from './client.store.js'; import { createJourneyStep } from './step.utils.js'; -import { JourneyClientConfig } from './config.types.js'; + +import type { GenericError, Step, WellknownResponse } from '@forgerock/sdk-types'; + +import type { JourneyClientConfig } from './config.types.js'; /** * Type guard to check if a result is a GenericError diff --git a/packages/journey-client/src/lib/client.store.ts b/packages/journey-client/src/lib/client.store.ts index 57bc2e7f03..74cc2d1842 100644 --- a/packages/journey-client/src/lib/client.store.ts +++ b/packages/journey-client/src/lib/client.store.ts @@ -5,31 +5,32 @@ * of the MIT license. See the LICENSE file for details. */ -import { logger as loggerFn, LogLevel, CustomLogger } from '@forgerock/sdk-logger'; +import { logger as loggerFn } from '@forgerock/sdk-logger'; import { callbackType } from '@forgerock/sdk-types'; import { + createWellknownError, isGenericError, isValidWellknownUrl, - createWellknownError, } from '@forgerock/sdk-utilities'; - -import type { GenericError } from '@forgerock/sdk-types'; -import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; -import type { Step } from '@forgerock/sdk-types'; +import { createStorage } from '@forgerock/storage'; import { createJourneyStore } from './client.store.utils.js'; import { configSlice } from './config.slice.js'; import { journeyApi } from './journey.api.js'; -import { createStorage } from '@forgerock/storage'; import { createJourneyObject } from './journey.utils.js'; import { wellknownApi } from './wellknown.api.js'; -import type { JourneyStep } from './step.utils.js'; -import type { JourneyClientConfig } from './config.types.js'; +import type { CustomLogger, LogLevel } from '@forgerock/sdk-logger'; +import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; +import type { GenericError } from '@forgerock/sdk-types'; +import type { Step } from '@forgerock/sdk-types'; + import type { RedirectCallback } from './callbacks/redirect-callback.js'; -import type { NextOptions, StartParam, ResumeOptions } from './interfaces.js'; +import type { JourneyClientConfig } from './config.types.js'; +import type { NextOptions, ResumeOptions, StartParam } from './interfaces.js'; import type { JourneyLoginFailure } from './login-failure.utils.js'; import type { JourneyLoginSuccess } from './login-success.utils.js'; +import type { JourneyStep } from './step.utils.js'; /** Result type for journey client methods. */ export type JourneyResult = JourneyStep | JourneyLoginSuccess | JourneyLoginFailure | GenericError; diff --git a/packages/journey-client/src/lib/client.store.utils.ts b/packages/journey-client/src/lib/client.store.utils.ts index 0e0b05c794..1eeb2782f5 100644 --- a/packages/journey-client/src/lib/client.store.utils.ts +++ b/packages/journey-client/src/lib/client.store.utils.ts @@ -5,14 +5,15 @@ * of the MIT license. See the LICENSE file for details. */ -import { logger as loggerFn } from '@forgerock/sdk-logger'; -import { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; import { combineReducers, configureStore } from '@reduxjs/toolkit'; import { configSlice } from './config.slice.js'; import { journeyApi } from './journey.api.js'; import { wellknownApi } from './wellknown.api.js'; +import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; + const rootReducer = combineReducers({ [journeyApi.reducerPath]: journeyApi.reducer, [configSlice.name]: configSlice.reducer, diff --git a/packages/journey-client/src/lib/client.types.test-d.ts b/packages/journey-client/src/lib/client.types.test-d.ts index 92c265713f..15c7e81050 100644 --- a/packages/journey-client/src/lib/client.types.test-d.ts +++ b/packages/journey-client/src/lib/client.types.test-d.ts @@ -10,9 +10,9 @@ import { describe, it } from 'vitest'; import type { GenericError } from '@forgerock/sdk-types'; import type { JourneyClient } from './client.types.js'; -import type { JourneyStep } from './step.utils.js'; -import type { JourneyLoginSuccess } from './login-success.utils.js'; import type { JourneyLoginFailure } from './login-failure.utils.js'; +import type { JourneyLoginSuccess } from './login-success.utils.js'; +import type { JourneyStep } from './step.utils.js'; /** * Resolves to `true` if `U` is a member of union `T`, `false` otherwise. diff --git a/packages/journey-client/src/lib/config.slice.test.ts b/packages/journey-client/src/lib/config.slice.test.ts index 0affaf7cce..de00fe369e 100644 --- a/packages/journey-client/src/lib/config.slice.test.ts +++ b/packages/journey-client/src/lib/config.slice.test.ts @@ -5,10 +5,12 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { configSlice } from './config.slice.js'; import type { WellknownResponse } from '@forgerock/sdk-types'; + import type { ResolvedConfig } from './config.slice.js'; function createMockWellknown(overrides: Partial = {}): WellknownResponse { diff --git a/packages/journey-client/src/lib/config.slice.ts b/packages/journey-client/src/lib/config.slice.ts index 02cac72102..ad481ef4e0 100644 --- a/packages/journey-client/src/lib/config.slice.ts +++ b/packages/journey-client/src/lib/config.slice.ts @@ -5,10 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { createSlice } from '@reduxjs/toolkit'; + +import { convertWellknown } from './wellknown.utils.js'; + import type { WellknownResponse } from '@forgerock/sdk-types'; +import type { PayloadAction } from '@reduxjs/toolkit'; + import type { InternalJourneyClientConfig } from './config.types.js'; -import { convertWellknown } from './wellknown.utils.js'; /** * Payload dispatched to the config slice after well-known resolution. diff --git a/packages/journey-client/src/lib/config.types.test-d.ts b/packages/journey-client/src/lib/config.types.test-d.ts index d314f040fe..4a7bc7d702 100644 --- a/packages/journey-client/src/lib/config.types.test-d.ts +++ b/packages/journey-client/src/lib/config.types.test-d.ts @@ -5,12 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ import { describe, expectTypeOf, it } from 'vitest'; + +import type { AsyncLegacyConfigOptions } from '@forgerock/sdk-types'; + import type { + InternalJourneyClientConfig, JourneyClientConfig, JourneyServerConfig, - InternalJourneyClientConfig, } from './config.types.js'; -import type { AsyncLegacyConfigOptions } from '@forgerock/sdk-types'; import type { ResolvedServerConfig } from './wellknown.utils.js'; describe('Config Types', () => { diff --git a/packages/journey-client/src/lib/config.types.ts b/packages/journey-client/src/lib/config.types.ts index 25eaeaa888..5a95d1bda7 100644 --- a/packages/journey-client/src/lib/config.types.ts +++ b/packages/journey-client/src/lib/config.types.ts @@ -6,6 +6,7 @@ */ import type { AsyncLegacyConfigOptions, GenericError } from '@forgerock/sdk-types'; + import type { ResolvedServerConfig } from './wellknown.utils.js'; /** diff --git a/packages/journey-client/src/lib/device/device-profile.test.ts b/packages/journey-client/src/lib/device/device-profile.test.ts index 0fd2d9a677..47b5efd6f6 100644 --- a/packages/journey-client/src/lib/device/device-profile.test.ts +++ b/packages/journey-client/src/lib/device/device-profile.test.ts @@ -7,7 +7,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { vi, expect, describe, it, afterEach, beforeEach, type MockInstance } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, type MockInstance, vi } from 'vitest'; import { Device } from './device-profile.js'; diff --git a/packages/journey-client/src/lib/device/device-profile.ts b/packages/journey-client/src/lib/device/device-profile.ts index 6c3e5f6b3c..b502ca61fa 100644 --- a/packages/journey-client/src/lib/device/device-profile.ts +++ b/packages/journey-client/src/lib/device/device-profile.ts @@ -8,10 +8,8 @@ * of the MIT license. See the LICENSE file for details. */ -import { reduceToObject, reduceToString } from '@forgerock/sdk-utilities'; import { logger as loggerFn } from '@forgerock/sdk-logger'; - -import type { LogLevel } from '@forgerock/sdk-logger'; +import { reduceToObject, reduceToString } from '@forgerock/sdk-utilities'; import { browserProps, @@ -24,6 +22,8 @@ import { platformProps, } from './defaults.js'; +import type { LogLevel } from '@forgerock/sdk-logger'; + import type { BaseProfileConfig, Category, diff --git a/packages/journey-client/src/lib/interfaces.ts b/packages/journey-client/src/lib/interfaces.ts index 0dc93ca842..deb04b5ab4 100644 --- a/packages/journey-client/src/lib/interfaces.ts +++ b/packages/journey-client/src/lib/interfaces.ts @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -import { JourneyStep } from './step.types.js'; +import type { JourneyStep } from './step.types.js'; export interface StartParam { journey: string; diff --git a/packages/journey-client/src/lib/journey.api.ts b/packages/journey-client/src/lib/journey.api.ts index 66c4da9a29..ee221b4c63 100644 --- a/packages/journey-client/src/lib/journey.api.ts +++ b/packages/journey-client/src/lib/journey.api.ts @@ -5,12 +5,13 @@ * of the MIT license. See the LICENSE file for details. */ -import { initQuery, RequestMiddleware } from '@forgerock/sdk-request-middleware'; -import { REQUESTED_WITH, getEndpointPath, stringify, resolve } from '@forgerock/sdk-utilities'; +import { initQuery } from '@forgerock/sdk-request-middleware'; +import { getEndpointPath, REQUESTED_WITH, resolve, stringify } from '@forgerock/sdk-utilities'; import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; -import type { Step } from '@forgerock/sdk-types'; import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { RequestMiddleware } from '@forgerock/sdk-request-middleware'; +import type { Step } from '@forgerock/sdk-types'; import type { BaseQueryApi, BaseQueryFn, @@ -20,10 +21,9 @@ import type { QueryReturnValue, } from '@reduxjs/toolkit/query'; -import { JourneyStep } from './step.types.js'; - import type { InternalJourneyClientConfig } from './config.types.js'; -import { NextOptions, StartParam } from './interfaces.js'; +import type { NextOptions, StartParam } from './interfaces.js'; +import type { JourneyStep } from './step.types.js'; /** * Minimal state type for accessing journey config from RTK Query endpoints. diff --git a/packages/journey-client/src/lib/journey.utils.ts b/packages/journey-client/src/lib/journey.utils.ts index 4a42cae87e..174f897fe7 100644 --- a/packages/journey-client/src/lib/journey.utils.ts +++ b/packages/journey-client/src/lib/journey.utils.ts @@ -7,15 +7,15 @@ import { StepType } from '@forgerock/sdk-types'; -import type { GenericError, Step } from '@forgerock/sdk-types'; - -import { createJourneyLoginSuccess } from './login-success.utils.js'; import { createJourneyLoginFailure } from './login-failure.utils.js'; +import { createJourneyLoginSuccess } from './login-success.utils.js'; import { createJourneyStep } from './step.utils.js'; -import type { JourneyStep } from './step.utils.js'; +import type { GenericError, Step } from '@forgerock/sdk-types'; + import type { JourneyLoginFailure } from './login-failure.utils.js'; import type { JourneyLoginSuccess } from './login-success.utils.js'; +import type { JourneyStep } from './step.utils.js'; /** * Creates a journey object from a raw Step response. diff --git a/packages/journey-client/src/lib/login-failure.utils.ts b/packages/journey-client/src/lib/login-failure.utils.ts index 88fa4cfcc8..d5444adc6e 100644 --- a/packages/journey-client/src/lib/login-failure.utils.ts +++ b/packages/journey-client/src/lib/login-failure.utils.ts @@ -5,10 +5,10 @@ */ import { StepType } from '@forgerock/sdk-types'; -import type { Step, AuthResponse, FailureDetail } from '@forgerock/sdk-types'; - import { Policy } from './policy/policy.js'; +import type { AuthResponse, FailureDetail, Step } from '@forgerock/sdk-types'; + import type { MessageCreator, ProcessedPropertyError } from './policy/interfaces.js'; type JourneyLoginFailure = AuthResponse & { diff --git a/packages/journey-client/src/lib/login-success.utils.ts b/packages/journey-client/src/lib/login-success.utils.ts index 1be9840c79..43684fbc09 100644 --- a/packages/journey-client/src/lib/login-success.utils.ts +++ b/packages/journey-client/src/lib/login-success.utils.ts @@ -6,7 +6,7 @@ import { StepType } from '@forgerock/sdk-types'; -import type { Step, AuthResponse } from '@forgerock/sdk-types'; +import type { AuthResponse, Step } from '@forgerock/sdk-types'; type JourneyLoginSuccess = AuthResponse & { type: StepType.LoginSuccess; diff --git a/packages/journey-client/src/lib/policy/policy.test.ts b/packages/journey-client/src/lib/policy/policy.test.ts index 3a5c65cac1..cd9e3c78b5 100644 --- a/packages/journey-client/src/lib/policy/policy.test.ts +++ b/packages/journey-client/src/lib/policy/policy.test.ts @@ -10,7 +10,9 @@ import { PolicyKey } from '@forgerock/sdk-types'; -import { Policy, MessageCreator } from './policy.js'; +import { Policy } from './policy.js'; + +import type { MessageCreator } from './policy.js'; describe('The IDM error handling', () => { const property = 'userName'; diff --git a/packages/journey-client/src/lib/policy/policy.ts b/packages/journey-client/src/lib/policy/policy.ts index ac562864d6..f363a73eef 100644 --- a/packages/journey-client/src/lib/policy/policy.ts +++ b/packages/journey-client/src/lib/policy/policy.ts @@ -6,10 +6,10 @@ import { PolicyKey } from '@forgerock/sdk-types'; -import type { FailedPolicyRequirement, PolicyRequirement, Step } from '@forgerock/sdk-types'; - import { defaultMessageCreator } from './message-creator.js'; +import type { FailedPolicyRequirement, PolicyRequirement, Step } from '@forgerock/sdk-types'; + import type { MessageCreator, ProcessedPropertyError } from './interfaces.js'; /** diff --git a/packages/journey-client/src/lib/qr-code/qr-code.test.ts b/packages/journey-client/src/lib/qr-code/qr-code.test.ts index 5067955907..961203710b 100644 --- a/packages/journey-client/src/lib/qr-code/qr-code.test.ts +++ b/packages/journey-client/src/lib/qr-code/qr-code.test.ts @@ -8,11 +8,11 @@ * of the MIT license. See the LICENSE file for details. */ -import { QRCode } from './qr-code.js'; -import { otpQRCodeStep, pushQRCodeStep } from './qr-code.mock.data.js'; import { createJourneyStep } from '../step.utils.js'; // import WebAuthn step as it's similar in structure for testing non-QR Code steps import { webAuthnRegJSCallback70 } from '../webauthn/webauthn.mock.data.js'; +import { QRCode } from './qr-code.js'; +import { otpQRCodeStep, pushQRCodeStep } from './qr-code.mock.data.js'; describe('Class for managing QR Codes', () => { it('should return true for step containing OTP QR Code callbacks', () => { diff --git a/packages/journey-client/src/lib/qr-code/qr-code.ts b/packages/journey-client/src/lib/qr-code/qr-code.ts index 8c64d7fbf0..e82a2fc58f 100644 --- a/packages/journey-client/src/lib/qr-code/qr-code.ts +++ b/packages/journey-client/src/lib/qr-code/qr-code.ts @@ -10,9 +10,8 @@ import { callbackType } from '@forgerock/sdk-types'; -import { TextOutputCallback } from '../callbacks/text-output-callback.js'; -import { HiddenValueCallback } from '../callbacks/hidden-value-callback.js'; - +import type { HiddenValueCallback } from '../callbacks/hidden-value-callback.js'; +import type { TextOutputCallback } from '../callbacks/text-output-callback.js'; import type { JourneyStep } from '../step.utils.js'; export type QRCodeData = { diff --git a/packages/journey-client/src/lib/recovery-codes/recovery-codes.test.ts b/packages/journey-client/src/lib/recovery-codes/recovery-codes.test.ts index f9f09c6fd8..bba870283b 100644 --- a/packages/journey-client/src/lib/recovery-codes/recovery-codes.test.ts +++ b/packages/journey-client/src/lib/recovery-codes/recovery-codes.test.ts @@ -8,8 +8,8 @@ * of the MIT license. See the LICENSE file for details. */ -import { RecoveryCodes } from './recovery-codes.js'; import { createJourneyStep } from '../step.utils.js'; +import { RecoveryCodes } from './recovery-codes.js'; import { displayRecoveryCodesResponse, expectedDeviceName, diff --git a/packages/journey-client/src/lib/step.test.ts b/packages/journey-client/src/lib/step.test.ts index 1406dd3497..edd6c6c0b9 100644 --- a/packages/journey-client/src/lib/step.test.ts +++ b/packages/journey-client/src/lib/step.test.ts @@ -6,12 +6,12 @@ */ import { callbackType } from '@forgerock/sdk-types'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; -import type { Step } from '@forgerock/sdk-types'; - -import { createJourneyStep } from './step.utils.js'; import { NameCallback } from './callbacks/name-callback.js'; +import { createJourneyStep } from './step.utils.js'; + +import type { Step } from '@forgerock/sdk-types'; describe('fr-step.ts', () => { const stepPayload: Step = { diff --git a/packages/journey-client/src/lib/step.utils.ts b/packages/journey-client/src/lib/step.utils.ts index 7218364b31..d90e797cc8 100644 --- a/packages/journey-client/src/lib/step.utils.ts +++ b/packages/journey-client/src/lib/step.utils.ts @@ -5,15 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ -import { type CallbackType, type Callback, type Step } from '@forgerock/sdk-types'; - +import { type Callback, type CallbackType, type Step } from '@forgerock/sdk-types'; import { StepType } from '@forgerock/sdk-types'; import { createCallback } from './callbacks/factory.js'; import type { BaseCallback } from './callbacks/base-callback.js'; -import type { JourneyStep } from './step.types.js'; import type { CallbackFactory } from './callbacks/factory.js'; +import type { JourneyStep } from './step.types.js'; function getCallbacksOfType( callbacks: BaseCallback[], diff --git a/packages/journey-client/src/lib/webauthn/helpers.test.ts b/packages/journey-client/src/lib/webauthn/helpers.test.ts index b81ed2a7c3..213c0ca3f7 100644 --- a/packages/journey-client/src/lib/webauthn/helpers.test.ts +++ b/packages/journey-client/src/lib/webauthn/helpers.test.ts @@ -10,10 +10,10 @@ import { parseCredentials, parsePubKeyArray } from './helpers.js'; import { - allowCredentials70, - allowMultipleCredentials70, acceptableCredentials653, acceptableMultipleCredentials653, + allowCredentials70, + allowMultipleCredentials70, pubKeyCredParamsStr, } from './helpers.mock.data.js'; diff --git a/packages/journey-client/src/lib/webauthn/helpers.ts b/packages/journey-client/src/lib/webauthn/helpers.ts index de5109b980..36181a82a7 100644 --- a/packages/journey-client/src/lib/webauthn/helpers.ts +++ b/packages/journey-client/src/lib/webauthn/helpers.ts @@ -14,6 +14,7 @@ * These are private utility functions for HttpClient */ import { WebAuthnOutcomeType } from './enums.js'; + import type { ParsedCredential } from './interfaces.js'; function ensureArray(arr: RegExpMatchArray | null): string[] { diff --git a/packages/journey-client/src/lib/webauthn/webauthn.test.ts b/packages/journey-client/src/lib/webauthn/webauthn.test.ts index 60714f1434..6db4031d9c 100644 --- a/packages/journey-client/src/lib/webauthn/webauthn.test.ts +++ b/packages/journey-client/src/lib/webauthn/webauthn.test.ts @@ -8,21 +8,21 @@ * of the MIT license. See the LICENSE file for details. */ +import { createJourneyStep } from '../step.utils.js'; import { WebAuthnStepType } from './enums.js'; import { WebAuthn } from './webauthn.js'; import { - webAuthnRegJSCallback653, - webAuthnAuthJSCallback653, - webAuthnRegJSCallback70, webAuthnAuthJSCallback70, - webAuthnRegMetaCallback70, + webAuthnAuthJSCallback70StoredUsername, + webAuthnAuthJSCallback653, webAuthnAuthMetaCallback70, + webAuthnAuthMetaCallback70StoredUsername, + webAuthnRegJSCallback70, webAuthnRegJSCallback70StoredUsername, - webAuthnAuthJSCallback70StoredUsername, + webAuthnRegJSCallback653, + webAuthnRegMetaCallback70, webAuthnRegMetaCallback70StoredUsername, - webAuthnAuthMetaCallback70StoredUsername, } from './webauthn.mock.data.js'; -import { createJourneyStep } from '../step.utils.js'; describe('Test FRWebAuthn class with 6.5.3 "Passwordless"', () => { it('should return Registration type with register text-output callbacks', () => { diff --git a/packages/journey-client/src/lib/webauthn/webauthn.ts b/packages/journey-client/src/lib/webauthn/webauthn.ts index 0c2da99b7f..8b2c8e111f 100644 --- a/packages/journey-client/src/lib/webauthn/webauthn.ts +++ b/packages/journey-client/src/lib/webauthn/webauthn.ts @@ -20,6 +20,8 @@ import { } from './helpers.js'; import type { HiddenValueCallback } from '../callbacks/hidden-value-callback.js'; +import type { MetadataCallback } from '../callbacks/metadata-callback.js'; +import type { TextOutputCallback } from '../callbacks/text-output-callback.js'; import type { JourneyStep } from '../step.utils.js'; import type { AttestationType, @@ -29,8 +31,6 @@ import type { WebAuthnRegistrationMetadata, WebAuthnTextOutputRegistration, } from './interfaces.js'; -import type { MetadataCallback } from '../callbacks/metadata-callback.js'; -import type { TextOutputCallback } from '../callbacks/text-output-callback.js'; // :::::: export type OutcomeWithName< diff --git a/packages/journey-client/src/lib/wellknown.api.ts b/packages/journey-client/src/lib/wellknown.api.ts index 2c1c41e5a2..d16c78e1de 100644 --- a/packages/journey-client/src/lib/wellknown.api.ts +++ b/packages/journey-client/src/lib/wellknown.api.ts @@ -5,8 +5,8 @@ * of the MIT license. See the LICENSE file for details. */ -import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; import { initWellknownQuery } from '@forgerock/sdk-oidc'; +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; import type { WellknownResponse } from '@forgerock/sdk-types'; import type { diff --git a/packages/journey-client/src/lib/wellknown.utils.test.ts b/packages/journey-client/src/lib/wellknown.utils.test.ts index 9160ec48a3..48c6c99a96 100644 --- a/packages/journey-client/src/lib/wellknown.utils.test.ts +++ b/packages/journey-client/src/lib/wellknown.utils.test.ts @@ -5,10 +5,12 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { convertWellknown } from './wellknown.utils.js'; import type { WellknownResponse } from '@forgerock/sdk-types'; + import type { ResolvedServerConfig } from './wellknown.utils.js'; function assertResolvedConfig( diff --git a/packages/oidc-client/api-report/oidc-client.api.md b/packages/oidc-client/api-report/oidc-client.api.md index e934c022e6..aac80eb3aa 100644 --- a/packages/oidc-client/api-report/oidc-client.api.md +++ b/packages/oidc-client/api-report/oidc-client.api.md @@ -15,7 +15,7 @@ import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; import { FetchBaseQueryMeta } from '@reduxjs/toolkit/query'; import { GenericError } from '@forgerock/sdk-types'; import { GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; -import { logger } from '@forgerock/sdk-logger'; +import type { logger } from '@forgerock/sdk-logger'; import { LogLevel } from '@forgerock/sdk-logger'; import { LogMessage } from '@forgerock/sdk-logger'; import { MutationDefinition } from '@reduxjs/toolkit/query'; diff --git a/packages/oidc-client/api-report/oidc-client.types.api.md b/packages/oidc-client/api-report/oidc-client.types.api.md index e934c022e6..aac80eb3aa 100644 --- a/packages/oidc-client/api-report/oidc-client.types.api.md +++ b/packages/oidc-client/api-report/oidc-client.types.api.md @@ -15,7 +15,7 @@ import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; import { FetchBaseQueryMeta } from '@reduxjs/toolkit/query'; import { GenericError } from '@forgerock/sdk-types'; import { GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; -import { logger } from '@forgerock/sdk-logger'; +import type { logger } from '@forgerock/sdk-logger'; import { LogLevel } from '@forgerock/sdk-logger'; import { LogMessage } from '@forgerock/sdk-logger'; import { MutationDefinition } from '@reduxjs/toolkit/query'; diff --git a/packages/oidc-client/src/__tests__/types-reexport.typecheck.ts b/packages/oidc-client/src/__tests__/types-reexport.typecheck.ts index 7d1d6bdb3d..52724c04fa 100644 --- a/packages/oidc-client/src/__tests__/types-reexport.typecheck.ts +++ b/packages/oidc-client/src/__tests__/types-reexport.typecheck.ts @@ -3,17 +3,17 @@ * Checked by tsc --noEmit, not executed at runtime. */ import type { + ActionTypes, + CustomLogger, // Already re-exported (regression guard) GenericError, GetAuthorizationUrlOptions, - WellknownResponse, - StorageConfig, - ActionTypes, - RequestMiddleware, - CustomLogger, LogLevel, + RequestMiddleware, // Should be re-exported but is not yet ResponseType, + StorageConfig, + WellknownResponse, } from '../types.js'; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/oidc-client/src/lib/authorize.request.micros.test.ts b/packages/oidc-client/src/lib/authorize.request.micros.test.ts index 289617eae9..6c3dc4f853 100644 --- a/packages/oidc-client/src/lib/authorize.request.micros.test.ts +++ b/packages/oidc-client/src/lib/authorize.request.micros.test.ts @@ -4,11 +4,11 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { it, expect } from '@effect/vitest'; -import { Micro } from 'effect'; -import { vi, afterEach } from 'vitest'; +import { expect, it } from '@effect/vitest'; import * as sdkOidc from '@forgerock/sdk-oidc'; import * as sdkUtilities from '@forgerock/sdk-utilities'; +import { Micro } from 'effect'; +import { afterEach, vi } from 'vitest'; import { buildParBodyµ, @@ -23,11 +23,12 @@ import { validateParResponseµ, } from './authorize.request.micros.js'; -import type { OidcConfig } from './config.types.js'; -import type { WellknownResponse } from '@forgerock/sdk-types'; -import type { ClientStore } from './client.types.js'; +import type { GetAuthorizationUrlOptions, WellknownResponse } from '@forgerock/sdk-types'; import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; +import type { ClientStore } from './client.types.js'; +import type { OidcConfig } from './config.types.js'; + // ─── Fixtures ──────────────────────────────────────────────────────────────── const clientId = 'test-client-id'; @@ -413,7 +414,7 @@ it.effect('dispatchAuthorizeIframeµ fails with unknown_error when data has no c mockStore, 'https://example.com/authorize?foo=bar', wellknown, - {} as import('@forgerock/sdk-types').GetAuthorizationUrlOptions, + {} as GetAuthorizationUrlOptions, ), ); expect(Micro.exitIsFailure(exit)).toBe(true); diff --git a/packages/oidc-client/src/lib/authorize.request.micros.ts b/packages/oidc-client/src/lib/authorize.request.micros.ts index 8c31bd2cc9..879ae56bff 100644 --- a/packages/oidc-client/src/lib/authorize.request.micros.ts +++ b/packages/oidc-client/src/lib/authorize.request.micros.ts @@ -16,15 +16,15 @@ import { buildParAuthorizeUrl, hasPushRequestUri, isFetchBaseQueryError, - toDispatchError, type PromptValue, + toDispatchError, } from './authorize.request.utils.js'; - import { oidcApi } from './oidc.api.js'; +import type { GetAuthorizationUrlOptions, WellknownResponse } from '@forgerock/sdk-types'; import type { SerializedError } from '@reduxjs/toolkit'; import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; -import type { GetAuthorizationUrlOptions, WellknownResponse } from '@forgerock/sdk-types'; + import type { AuthorizationError, AuthorizationSuccess, diff --git a/packages/oidc-client/src/lib/authorize.request.ts b/packages/oidc-client/src/lib/authorize.request.ts index 826ce8ec51..70cba2b04e 100644 --- a/packages/oidc-client/src/lib/authorize.request.ts +++ b/packages/oidc-client/src/lib/authorize.request.ts @@ -4,10 +4,8 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { CustomLogger } from '@forgerock/sdk-logger'; import { Micro } from 'effect'; -import { buildAuthorizeOptions } from './authorize.request.utils.js'; import { buildParBodyµ, buildParSlimUrlµ, @@ -20,8 +18,11 @@ import { storeAuthOptionsµ, validateParResponseµ, } from './authorize.request.micros.js'; +import { buildAuthorizeOptions } from './authorize.request.utils.js'; +import type { CustomLogger } from '@forgerock/sdk-logger'; import type { GetAuthorizationUrlOptions, WellknownResponse } from '@forgerock/sdk-types'; + import type { AuthorizationError, AuthorizationSuccess, diff --git a/packages/oidc-client/src/lib/authorize.request.utils.test.ts b/packages/oidc-client/src/lib/authorize.request.utils.test.ts index f850406461..c7dceca7a6 100644 --- a/packages/oidc-client/src/lib/authorize.request.utils.test.ts +++ b/packages/oidc-client/src/lib/authorize.request.utils.test.ts @@ -4,23 +4,27 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { it, expect } from '@effect/vitest'; -import { Micro } from 'effect'; -import { vi, afterEach } from 'vitest'; +import { expect, it } from '@effect/vitest'; import * as sdkOidc from '@forgerock/sdk-oidc'; -import { createParAuthorizeUrlµ, authorizeµ } from './authorize.request.js'; +import { Micro } from 'effect'; +import { afterEach, vi } from 'vitest'; + +import { authorizeµ, createParAuthorizeUrlµ } from './authorize.request.js'; import { - toAuthorizationError, - isFetchBaseQueryError, - toDispatchError, - isStringRecord, - hasPushRequestUri, buildAuthorizeOptions, buildParAuthorizeUrl, + hasPushRequestUri, + isFetchBaseQueryError, + isStringRecord, + toAuthorizationError, + toDispatchError, } from './authorize.request.utils.js'; -import type { OidcConfig } from './config.types.js'; + +import type { CustomLogger } from '@forgerock/sdk-logger'; import type { WellknownResponse } from '@forgerock/sdk-types'; + import type { ClientStore } from './client.types.js'; +import type { OidcConfig } from './config.types.js'; const clientId = '123456789'; const redirectUri = 'https://example.com/callback.html'; @@ -60,7 +64,7 @@ const mockLog = { error: vi.fn(), info: vi.fn(), warn: vi.fn(), -} as unknown as import('@forgerock/sdk-logger').CustomLogger; +} as unknown as CustomLogger; const sessionStorageStub = { getItem: vi.fn(), setItem: vi.fn(), removeItem: vi.fn() }; diff --git a/packages/oidc-client/src/lib/authorize.request.utils.ts b/packages/oidc-client/src/lib/authorize.request.utils.ts index ae70d9874f..4f01aa008b 100644 --- a/packages/oidc-client/src/lib/authorize.request.utils.ts +++ b/packages/oidc-client/src/lib/authorize.request.utils.ts @@ -4,9 +4,10 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +import type { GetAuthorizationUrlOptions, WellknownResponse } from '@forgerock/sdk-types'; import type { SerializedError } from '@reduxjs/toolkit'; import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; -import type { WellknownResponse, GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; + import type { AuthorizationError, OptionalAuthorizeOptions } from './authorize.request.types.js'; import type { OidcConfig } from './config.types.js'; diff --git a/packages/oidc-client/src/lib/client.store.test.ts b/packages/oidc-client/src/lib/client.store.test.ts index d15f8352ba..644f65fb41 100644 --- a/packages/oidc-client/src/lib/client.store.test.ts +++ b/packages/oidc-client/src/lib/client.store.test.ts @@ -7,7 +7,7 @@ import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; -import { it, expect, describe, vi, beforeEach, afterEach, afterAll, beforeAll } from 'vitest'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { oidc } from './client.store.js'; diff --git a/packages/oidc-client/src/lib/client.store.ts b/packages/oidc-client/src/lib/client.store.ts index 5a79f04ace..244bdab86c 100644 --- a/packages/oidc-client/src/lib/client.store.ts +++ b/packages/oidc-client/src/lib/client.store.ts @@ -11,16 +11,19 @@ import { Micro } from 'effect'; import { causeIsDie, exitIsFail, exitIsSuccess } from 'effect/Micro'; import { authorizeµ, createParAuthorizeUrlµ } from './authorize.request.js'; -import { buildTokenExchangeµ } from './exchange.request.js'; import { createClientStore, createTokenError } from './client.store.utils.js'; +import { buildTokenExchangeµ } from './exchange.request.js'; +import { logoutµ } from './logout.request.js'; import { oidcApi } from './oidc.api.js'; +import { isExpiryWithinThreshold } from './token.utils.js'; import { wellknownApi, wellknownSelector } from './wellknown.api.js'; +import type { CustomLogger, LogLevel } from '@forgerock/sdk-logger'; import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; import type { GenericError, GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; -import type { CustomLogger, LogLevel } from '@forgerock/sdk-logger'; import type { StorageConfig } from '@forgerock/storage'; +import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js'; import type { GetTokensOptions, LogoutErrorResult, @@ -30,10 +33,7 @@ import type { UserInfoResponse, } from './client.types.js'; import type { OauthTokens, OidcConfig } from './config.types.js'; -import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js'; import type { TokenExchangeErrorResponse } from './exchange.types.js'; -import { isExpiryWithinThreshold } from './token.utils.js'; -import { logoutµ } from './logout.request.js'; /** * @function oidc diff --git a/packages/oidc-client/src/lib/client.store.utils.ts b/packages/oidc-client/src/lib/client.store.utils.ts index f7c5f30792..1c41c8b886 100644 --- a/packages/oidc-client/src/lib/client.store.utils.ts +++ b/packages/oidc-client/src/lib/client.store.utils.ts @@ -4,13 +4,13 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; -import { logger as loggerFn } from '@forgerock/sdk-logger'; - import { configureStore, type SerializedError } from '@reduxjs/toolkit'; + import { oidcApi } from './oidc.api.js'; import { wellknownApi } from './wellknown.api.js'; +import type { logger as loggerFn } from '@forgerock/sdk-logger'; +import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware'; import type { GenericError } from '@forgerock/sdk-types'; import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; diff --git a/packages/oidc-client/src/lib/client.types.ts b/packages/oidc-client/src/lib/client.types.ts index 6a04c919b3..c2b9979b2f 100644 --- a/packages/oidc-client/src/lib/client.types.ts +++ b/packages/oidc-client/src/lib/client.types.ts @@ -6,8 +6,9 @@ */ import type { GenericError, GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; import type { StorageConfig } from '@forgerock/storage'; -import { createClientStore } from './client.store.utils.js'; -import { oidc } from './client.store.js'; + +import type { oidc } from './client.store.js'; +import type { createClientStore } from './client.store.utils.js'; export type OidcClient = Awaited>; diff --git a/packages/oidc-client/src/lib/exchange.request.ts b/packages/oidc-client/src/lib/exchange.request.ts index 4fb4e57110..b78b1d99be 100644 --- a/packages/oidc-client/src/lib/exchange.request.ts +++ b/packages/oidc-client/src/lib/exchange.request.ts @@ -6,14 +6,14 @@ */ import { Micro } from 'effect'; -import { logger } from '@forgerock/sdk-logger'; - import { createValuesµ, handleTokenResponseµ, validateValuesµ } from './exchange.utils.js'; import { oidcApi } from './oidc.api.js'; +import type { logger } from '@forgerock/sdk-logger'; +import type { StorageConfig } from '@forgerock/storage'; + import type { ClientStore } from './client.types.js'; import type { OauthTokens, OidcConfig } from './config.types.js'; -import type { StorageConfig } from '@forgerock/storage'; import type { TokenExchangeErrorResponse } from './exchange.types.js'; interface BuildTokenExchangeµParams { diff --git a/packages/oidc-client/src/lib/exchange.utils.test.ts b/packages/oidc-client/src/lib/exchange.utils.test.ts index d64cccabc8..5821a41e69 100644 --- a/packages/oidc-client/src/lib/exchange.utils.test.ts +++ b/packages/oidc-client/src/lib/exchange.utils.test.ts @@ -4,12 +4,15 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { it, expect } from '@effect/vitest'; +import { expect, it } from '@effect/vitest'; import { Micro } from 'effect'; + import { handleTokenResponseµ, validateValuesµ } from './exchange.utils.js'; -import type { OidcConfig } from './config.types.js'; + import type { GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; +import type { OidcConfig } from './config.types.js'; + const clientId = '123456789'; const redirectUri = 'https://example.com/callback.html'; const scope = 'openid profile'; diff --git a/packages/oidc-client/src/lib/exchange.utils.ts b/packages/oidc-client/src/lib/exchange.utils.ts index b3314a6ab4..607a83cdaf 100644 --- a/packages/oidc-client/src/lib/exchange.utils.ts +++ b/packages/oidc-client/src/lib/exchange.utils.ts @@ -4,17 +4,17 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import type { SerializedError } from '@reduxjs/toolkit'; -import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; +import { getStoredAuthUrlValues } from '@forgerock/sdk-oidc'; import { Micro } from 'effect'; -import { getStoredAuthUrlValues } from '@forgerock/sdk-oidc'; import type { GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; import type { StorageConfig } from '@forgerock/storage'; +import type { SerializedError } from '@reduxjs/toolkit'; +import type { FetchBaseQueryError } from '@reduxjs/toolkit/query'; +import type { OidcConfig } from './config.types.js'; import type { TokenExchangeResponse, TokenRequestOptions } from './exchange.types.js'; import type { TokenExchangeErrorResponse } from './exchange.types.js'; -import type { OidcConfig } from './config.types.js'; export function createValuesµ( code: string, diff --git a/packages/oidc-client/src/lib/logout.request.test.ts b/packages/oidc-client/src/lib/logout.request.test.ts index 09bc0af911..8fbcf3f8b2 100644 --- a/packages/oidc-client/src/lib/logout.request.test.ts +++ b/packages/oidc-client/src/lib/logout.request.test.ts @@ -4,15 +4,17 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { it, expect, describe } from '@effect/vitest'; +import { describe, expect, it } from '@effect/vitest'; +import { logger as loggerFn } from '@forgerock/sdk-logger'; +import { createStorage } from '@forgerock/storage'; import { Micro } from 'effect'; -import { deepStrictEqual } from 'node:assert'; -import { setupServer } from 'msw/node'; import { http, HttpResponse } from 'msw'; -import { logoutµ } from './logout.request.js'; -import { createStorage } from '@forgerock/storage'; +import { setupServer } from 'msw/node'; +import { deepStrictEqual } from 'node:assert'; + import { createClientStore } from './client.store.utils.js'; -import { logger as loggerFn } from '@forgerock/sdk-logger'; +import { logoutµ } from './logout.request.js'; + import type { OauthTokens, OidcConfig } from './config.types.js'; const server = setupServer( diff --git a/packages/oidc-client/src/lib/logout.request.ts b/packages/oidc-client/src/lib/logout.request.ts index 92ee6869d6..030cfecf8a 100644 --- a/packages/oidc-client/src/lib/logout.request.ts +++ b/packages/oidc-client/src/lib/logout.request.ts @@ -5,13 +5,15 @@ * of the MIT license. See the LICENSE file for details. */ import { Micro } from 'effect'; -import { oidcApi } from './oidc.api.js'; + import { createLogoutError } from './client.store.utils.js'; +import { oidcApi } from './oidc.api.js'; -import type { OauthTokens, OidcConfig } from './config.types.js'; import type { WellknownResponse } from '@forgerock/sdk-types'; import type { StorageClient } from '@forgerock/storage'; + import type { ClientStore, LogoutErrorResult, LogoutSuccessResult } from './client.types.js'; +import type { OauthTokens, OidcConfig } from './config.types.js'; export function logoutµ({ tokens, diff --git a/packages/oidc-client/src/lib/oidc.api.ts b/packages/oidc-client/src/lib/oidc.api.ts index 1fee7fd373..bcc2ee40b3 100644 --- a/packages/oidc-client/src/lib/oidc.api.ts +++ b/packages/oidc-client/src/lib/oidc.api.ts @@ -4,25 +4,27 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ +import { iFrameManager } from '@forgerock/iframe-manager'; +import { + type ActionTypes, + initQuery, + type RequestMiddleware, +} from '@forgerock/sdk-request-middleware'; import { createApi, - fetchBaseQuery, type FetchArgs, + fetchBaseQuery, type FetchBaseQueryError, } from '@reduxjs/toolkit/query'; -import type { OidcConfig } from './config.types.js'; + import { transformError } from './oidc.api.utils.js'; -import { iFrameManager } from '@forgerock/iframe-manager'; -import { - initQuery, - type ActionTypes, - type RequestMiddleware, -} from '@forgerock/sdk-request-middleware'; import type { logger as loggerFn } from '@forgerock/sdk-logger'; -import type { TokenExchangeResponse } from './exchange.types.js'; + import type { AuthorizationSuccess, AuthorizeSuccessResponse } from './authorize.request.types.js'; import type { UserInfoResponse } from './client.types.js'; +import type { OidcConfig } from './config.types.js'; +import type { TokenExchangeResponse } from './exchange.types.js'; import type { PushAuthorizationResponse } from './par.types.js'; interface Extras { diff --git a/packages/oidc-client/src/lib/oidc.api.utils.ts b/packages/oidc-client/src/lib/oidc.api.utils.ts index 5f8283f401..47e2704173 100644 --- a/packages/oidc-client/src/lib/oidc.api.utils.ts +++ b/packages/oidc-client/src/lib/oidc.api.utils.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { GenericError } from '@forgerock/sdk-types'; +import type { GenericError } from '@forgerock/sdk-types'; export function transformError( error: string, diff --git a/packages/oidc-client/src/lib/wellknown.api.ts b/packages/oidc-client/src/lib/wellknown.api.ts index b4da332e53..47d4489620 100644 --- a/packages/oidc-client/src/lib/wellknown.api.ts +++ b/packages/oidc-client/src/lib/wellknown.api.ts @@ -5,9 +5,9 @@ * of the MIT license. See the LICENSE file for details. */ +import { initWellknownQuery } from '@forgerock/sdk-oidc'; import { createSelector } from '@reduxjs/toolkit'; import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'; -import { initWellknownQuery } from '@forgerock/sdk-oidc'; import type { WellknownResponse } from '@forgerock/sdk-types'; import type { @@ -15,6 +15,7 @@ import type { FetchBaseQueryMeta, QueryReturnValue, } from '@reduxjs/toolkit/query'; + import type { RootState } from './client.types.js'; /** diff --git a/packages/protect/src/lib/protect.test.ts b/packages/protect/src/lib/protect.test.ts index ed3a0d96a3..f50d080556 100644 --- a/packages/protect/src/lib/protect.test.ts +++ b/packages/protect/src/lib/protect.test.ts @@ -8,7 +8,8 @@ */ import { protect } from './protect.js'; -import { ProtectConfig, Protect } from './protect.types.js'; + +import type { Protect, ProtectConfig } from './protect.types.js'; const config: ProtectConfig = { envId: '12345', diff --git a/packages/protect/src/lib/protect.ts b/packages/protect/src/lib/protect.ts index c25a9fe75c..99bbacfd13 100644 --- a/packages/protect/src/lib/protect.ts +++ b/packages/protect/src/lib/protect.ts @@ -7,7 +7,7 @@ * */ -import { Protect, ProtectConfig, SignalsInitializationOptions } from './protect.types.js'; +import type { Protect, ProtectConfig, SignalsInitializationOptions } from './protect.types.js'; // Add Signals SDK namespace to the window object declare global { diff --git a/packages/sdk-effects/iframe-manager/src/lib/iframe-manager.effects.test.ts b/packages/sdk-effects/iframe-manager/src/lib/iframe-manager.effects.test.ts index 688e9e481a..155ec9736e 100644 --- a/packages/sdk-effects/iframe-manager/src/lib/iframe-manager.effects.test.ts +++ b/packages/sdk-effects/iframe-manager/src/lib/iframe-manager.effects.test.ts @@ -6,6 +6,7 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + import { iFrameManager } from './iframe-manager.effects.js'; /** diff --git a/packages/sdk-effects/logger/src/lib/logger.effects.ts b/packages/sdk-effects/logger/src/lib/logger.effects.ts index be365c4221..8490fe46bd 100644 --- a/packages/sdk-effects/logger/src/lib/logger.effects.ts +++ b/packages/sdk-effects/logger/src/lib/logger.effects.ts @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -import { CustomLogger, LogLevel, LogMessage } from './logger.types.js'; +import type { CustomLogger, LogLevel, LogMessage } from './logger.types.js'; export function logger(config: { level: LogLevel; custom?: CustomLogger }) { let logLevel: LogLevel = config.level || 'info'; diff --git a/packages/sdk-effects/logger/src/lib/logger.test.ts b/packages/sdk-effects/logger/src/lib/logger.test.ts index cd36e2c107..ec3068992c 100644 --- a/packages/sdk-effects/logger/src/lib/logger.test.ts +++ b/packages/sdk-effects/logger/src/lib/logger.test.ts @@ -5,7 +5,8 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; + import { logger } from './logger.effects.js'; describe('logger', () => { diff --git a/packages/sdk-effects/oidc/src/lib/authorize.effects.ts b/packages/sdk-effects/oidc/src/lib/authorize.effects.ts index f196238674..5ca04240f1 100644 --- a/packages/sdk-effects/oidc/src/lib/authorize.effects.ts +++ b/packages/sdk-effects/oidc/src/lib/authorize.effects.ts @@ -10,8 +10,8 @@ */ import { createChallenge } from '@forgerock/sdk-utilities'; -import { generateAndStoreAuthUrlValues } from './state-pkce.effects.js'; import { buildAuthorizeParams } from './authorize.utils.js'; +import { generateAndStoreAuthUrlValues } from './state-pkce.effects.js'; import type { GetAuthorizationUrlOptions } from '@forgerock/sdk-types'; diff --git a/packages/sdk-effects/oidc/src/lib/authorize.test.ts b/packages/sdk-effects/oidc/src/lib/authorize.test.ts index 484e8bed25..607b6f109a 100644 --- a/packages/sdk-effects/oidc/src/lib/authorize.test.ts +++ b/packages/sdk-effects/oidc/src/lib/authorize.test.ts @@ -5,12 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ -import type { GenerateAndStoreAuthUrlValues } from '@forgerock/sdk-types'; -import { describe, expect, it, beforeEach } from 'vitest'; +import { beforeEach, describe, expect, it } from 'vitest'; + import { createAuthorizeUrl } from './authorize.effects.js'; import { buildAuthorizeParams } from './authorize.utils.js'; import { getStorageKey } from './state-pkce.effects.js'; +import type { GenerateAndStoreAuthUrlValues } from '@forgerock/sdk-types'; + const mockSessionStorage = (() => { let store: { [key: string]: string } = {}; return { diff --git a/packages/sdk-effects/oidc/src/lib/state-pkce.effects.ts b/packages/sdk-effects/oidc/src/lib/state-pkce.effects.ts index f24df9fdfb..9d04a28a84 100644 --- a/packages/sdk-effects/oidc/src/lib/state-pkce.effects.ts +++ b/packages/sdk-effects/oidc/src/lib/state-pkce.effects.ts @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -import { createVerifier, createState } from '@forgerock/sdk-utilities'; +import { createState, createVerifier } from '@forgerock/sdk-utilities'; import type { GenerateAndStoreAuthUrlValues, diff --git a/packages/sdk-effects/oidc/src/lib/state-pkce.test.ts b/packages/sdk-effects/oidc/src/lib/state-pkce.test.ts index 8c2e67b834..68772ad58d 100644 --- a/packages/sdk-effects/oidc/src/lib/state-pkce.test.ts +++ b/packages/sdk-effects/oidc/src/lib/state-pkce.test.ts @@ -5,12 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, expect, it, beforeEach } from 'vitest'; +import { beforeEach, describe, expect, it } from 'vitest'; + import { generateAndStoreAuthUrlValues, getStorageKey, getStoredAuthUrlValues, } from './state-pkce.effects.js'; + import type { GenerateAndStoreAuthUrlValues } from '@forgerock/sdk-types'; const mockSessionStorage = (() => { diff --git a/packages/sdk-effects/oidc/src/lib/wellknown.effects.test.ts b/packages/sdk-effects/oidc/src/lib/wellknown.effects.test.ts index cbf7033e30..4b551bc32b 100644 --- a/packages/sdk-effects/oidc/src/lib/wellknown.effects.test.ts +++ b/packages/sdk-effects/oidc/src/lib/wellknown.effects.test.ts @@ -5,8 +5,9 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; -import { isValidWellknownResponse, initWellknownQuery } from './wellknown.effects.js'; +import { describe, expect, it } from 'vitest'; + +import { initWellknownQuery, isValidWellknownResponse } from './wellknown.effects.js'; import type { WellknownResponse } from '@forgerock/sdk-types'; diff --git a/packages/sdk-effects/oidc/src/lib/wellknown.effects.ts b/packages/sdk-effects/oidc/src/lib/wellknown.effects.ts index 3836173422..29115c2914 100644 --- a/packages/sdk-effects/oidc/src/lib/wellknown.effects.ts +++ b/packages/sdk-effects/oidc/src/lib/wellknown.effects.ts @@ -5,7 +5,7 @@ * of the MIT license. See the LICENSE file for details. */ -import type { WellknownResponse, GenericError } from '@forgerock/sdk-types'; +import type { GenericError, WellknownResponse } from '@forgerock/sdk-types'; /** * Structural types compatible with RTK Query's shapes. diff --git a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.effects.ts b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.effects.ts index bd27a87d57..dae82da6e4 100644 --- a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.effects.ts +++ b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.effects.ts @@ -5,15 +5,15 @@ * of the MIT license. See the LICENSE file for details. */ -import { +import { actionTypes } from './request-mware.derived.js'; + +import type { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue, } from '@reduxjs/toolkit/query'; -import { actionTypes } from './request-mware.derived.js'; - import type { ActionTypes, EndpointTypes } from './request-mware.derived.js'; import type { ModifiedFetchArgs, RequestMiddleware } from './request-mware.types.js'; diff --git a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.test.ts b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.test.ts index acecbdc391..1bf95baef3 100644 --- a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.test.ts +++ b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.test.ts @@ -5,7 +5,10 @@ * of the MIT license. See the LICENSE file for details. */ -import { +import { initQuery, middlewareWrapper } from './request-mware.effects.js'; +import middleware from './request-mware.mock.js'; + +import type { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, @@ -15,9 +18,6 @@ import { import type { ActionTypes } from './request-mware.derived.js'; import type { Action, ModifiedFetchArgs } from './request-mware.types.js'; -import { initQuery, middlewareWrapper } from './request-mware.effects.js'; -import middleware from './request-mware.mock.js'; - type BaseQueryResponse = Promise< QueryReturnValue >; diff --git a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.types.ts b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.types.ts index 55973eecde..19a6348645 100644 --- a/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.types.ts +++ b/packages/sdk-effects/sdk-request-middleware/src/lib/request-mware.types.ts @@ -5,14 +5,14 @@ * of the MIT license. See the LICENSE file for details. */ -import { +import type { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue, } from '@reduxjs/toolkit/query'; -import { ActionTypes } from './request-mware.derived.js'; +import type { ActionTypes } from './request-mware.derived.js'; export type RequestMiddleware = ( req: ModifiedFetchArgs, diff --git a/packages/sdk-effects/storage/src/lib/storage.effects.test.ts b/packages/sdk-effects/storage/src/lib/storage.effects.test.ts index 2d4357a83e..2d068dd5e0 100644 --- a/packages/sdk-effects/storage/src/lib/storage.effects.test.ts +++ b/packages/sdk-effects/storage/src/lib/storage.effects.test.ts @@ -4,8 +4,10 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; + import { createStorage, type StorageConfig } from './storage.effects.js'; + import type { CustomStorageObject, GenericError } from '@forgerock/sdk-types'; const localStorageMock = (() => { diff --git a/packages/sdk-effects/storage/src/lib/storage.effects.ts b/packages/sdk-effects/storage/src/lib/storage.effects.ts index 64706f07f4..cb6aae6d38 100644 --- a/packages/sdk-effects/storage/src/lib/storage.effects.ts +++ b/packages/sdk-effects/storage/src/lib/storage.effects.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { CustomStorageObject, GenericError } from '@forgerock/sdk-types'; +import type { CustomStorageObject, GenericError } from '@forgerock/sdk-types'; export interface StorageClient { get: () => Promise; diff --git a/packages/sdk-types/src/lib/config.types.ts b/packages/sdk-types/src/lib/config.types.ts index 4a4a3f63cf..fdba93749f 100644 --- a/packages/sdk-types/src/lib/config.types.ts +++ b/packages/sdk-types/src/lib/config.types.ts @@ -4,7 +4,7 @@ * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ -import { CustomStorageObject } from './tokens.types.js'; +import type { CustomStorageObject } from './tokens.types.js'; /** * Union of possible OAuth Configs diff --git a/packages/sdk-types/src/lib/legacy-config.types.ts b/packages/sdk-types/src/lib/legacy-config.types.ts index a66da83553..f92e0e6cd2 100644 --- a/packages/sdk-types/src/lib/legacy-config.types.ts +++ b/packages/sdk-types/src/lib/legacy-config.types.ts @@ -11,7 +11,7 @@ import type { Callback, CustomPathConfig } from './am-callback.types.js'; import type { LegacyRequestMiddleware } from './legacy-mware.types.js'; -import { CustomStorageObject } from './tokens.types.js'; +import type { CustomStorageObject } from './tokens.types.js'; /** * Configuration settings for connecting to a server. diff --git a/packages/sdk-utilities/src/lib/error/error.utils.test.ts b/packages/sdk-utilities/src/lib/error/error.utils.test.ts index d71b707167..873dc204a0 100644 --- a/packages/sdk-utilities/src/lib/error/error.utils.test.ts +++ b/packages/sdk-utilities/src/lib/error/error.utils.test.ts @@ -5,8 +5,10 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { isGenericError } from './error.utils.js'; + import type { GenericError } from '@forgerock/sdk-types'; describe('isGenericError', () => { diff --git a/packages/sdk-utilities/src/lib/oidc/pkce.test.ts b/packages/sdk-utilities/src/lib/oidc/pkce.test.ts index 6747f0cd83..ca60e464d1 100644 --- a/packages/sdk-utilities/src/lib/oidc/pkce.test.ts +++ b/packages/sdk-utilities/src/lib/oidc/pkce.test.ts @@ -10,9 +10,10 @@ /** * @jest-environment jsdom */ -import { expect, describe, it } from 'vitest'; import * as crypto from 'crypto'; import { TextEncoder } from 'util'; +import { describe, expect, it } from 'vitest'; + import { createChallenge, createVerifier } from './pkce.utils.js'; declare let window: unknown; diff --git a/packages/sdk-utilities/src/lib/url/am-url.test.ts b/packages/sdk-utilities/src/lib/url/am-url.test.ts index 7c447d6e0f..b3b2b6eee0 100644 --- a/packages/sdk-utilities/src/lib/url/am-url.test.ts +++ b/packages/sdk-utilities/src/lib/url/am-url.test.ts @@ -8,7 +8,8 @@ */ import { getEndpointPath, getRealmUrlPath } from './am-url.utils.js'; -import { GetEndpointPathParams } from './am-url.types.js'; + +import type { GetEndpointPathParams } from './am-url.types.js'; describe('The URL utility functions', () => { it('getRealmUrlPath creates the correct paths', () => { diff --git a/packages/sdk-utilities/src/lib/wellknown/wellknown.utils.test.ts b/packages/sdk-utilities/src/lib/wellknown/wellknown.utils.test.ts index e325c6dac5..22cfa62df6 100644 --- a/packages/sdk-utilities/src/lib/wellknown/wellknown.utils.test.ts +++ b/packages/sdk-utilities/src/lib/wellknown/wellknown.utils.test.ts @@ -5,8 +5,9 @@ * of the MIT license. See the LICENSE file for details. */ -import { describe, it, expect } from 'vitest'; -import { isValidWellknownUrl, createWellknownError } from './wellknown.utils.js'; +import { describe, expect, it } from 'vitest'; + +import { createWellknownError, isValidWellknownUrl } from './wellknown.utils.js'; describe('wellknown.utils', () => { describe('isValidWellknownUrl', () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eeb837145b..47a76c826f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -209,6 +209,9 @@ importers: eslint-plugin-prettier: specifier: ^5.2.3 version: 5.5.4(@types/eslint@9.6.1)(eslint-config-prettier@10.1.8(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1))(prettier@3.8.3) + eslint-plugin-simple-import-sort: + specifier: ^13.0.0 + version: 13.0.0(eslint@9.39.4(jiti@2.6.1)) fast-check: specifier: ^4.0.0 version: 4.7.0 @@ -501,6 +504,12 @@ importers: tslib: specifier: 'catalog:' version: 2.8.1 + vitest: + specifier: catalog:vitest + version: 3.2.4(@types/node@24.9.2)(@vitest/ui@3.2.4)(jiti@2.6.1)(jsdom@27.4.0(@noble/hashes@1.8.0))(msw@2.12.1(@types/node@24.9.2)(typescript@5.9.3))(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.1) + vitest-canvas-mock: + specifier: catalog:vitest + version: 1.1.3(vitest@3.2.4) devDependencies: '@vitest/coverage-v8': specifier: catalog:vitest @@ -508,12 +517,6 @@ importers: vite: specifier: catalog:vite version: 7.3.2(@types/node@24.9.2)(jiti@2.6.1)(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.1) - vitest: - specifier: catalog:vitest - version: 3.2.4(@types/node@24.9.2)(@vitest/ui@3.2.4)(jiti@2.6.1)(jsdom@27.4.0(@noble/hashes@1.8.0))(msw@2.12.1(@types/node@24.9.2)(typescript@5.9.3))(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.1) - vitest-canvas-mock: - specifier: catalog:vitest - version: 1.1.3(vitest@3.2.4) packages/oidc-client: dependencies: @@ -614,9 +617,6 @@ importers: ts-morph: specifier: ^28.0.0 version: 28.0.0 - tsx: - specifier: 'catalog:' - version: 4.21.0 vitest: specifier: catalog:vitest version: 3.2.4(@types/node@24.9.2)(@vitest/ui@3.2.4)(jiti@2.6.1)(jsdom@27.4.0(@noble/hashes@1.8.0))(msw@2.12.1(@types/node@24.9.2)(typescript@5.9.3))(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.1) @@ -3247,6 +3247,7 @@ packages: '@ungap/structured-clone@1.3.0': resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} + deprecated: Potential CWE-502 - Update to 1.3.1 or higher '@unrs/resolver-binding-android-arm-eabi@1.11.1': resolution: {integrity: sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==} @@ -4860,6 +4861,11 @@ packages: eslint-config-prettier: optional: true + eslint-plugin-simple-import-sort@13.0.0: + resolution: {integrity: sha512-McAc+/Nlvcg4byY/CABGH8kqnefWBj8s3JA2okEtz8ixbECQgU46p0HkTUKa4YS7wvgGceimlc34p1nXqbWqtA==} + peerDependencies: + eslint: '>=5.0.0' + eslint-scope@5.1.1: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} @@ -13372,6 +13378,10 @@ snapshots: '@types/eslint': 9.6.1 eslint-config-prettier: 10.1.8(eslint@9.39.4(jiti@2.6.1)) + eslint-plugin-simple-import-sort@13.0.0(eslint@9.39.4(jiti@2.6.1)): + dependencies: + eslint: 9.39.4(jiti@2.6.1) + eslint-scope@5.1.1: dependencies: esrecurse: 4.3.0 diff --git a/tools/api-report/src/config.spec.ts b/tools/api-report/src/config.spec.ts index 8fe5452711..edbdbfca2a 100644 --- a/tools/api-report/src/config.spec.ts +++ b/tools/api-report/src/config.spec.ts @@ -1,4 +1,5 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { buildReportFileName } from './config.js'; describe('buildReportFileName', () => { diff --git a/tools/api-report/src/config.ts b/tools/api-report/src/config.ts index 1f6224e9be..b952aab13a 100644 --- a/tools/api-report/src/config.ts +++ b/tools/api-report/src/config.ts @@ -1,5 +1,6 @@ import { ExtractorConfig, ExtractorLogLevel } from '@microsoft/api-extractor'; import { resolve } from 'node:path'; + import type { EntryPoint } from './resolve-entries.js'; const WORKSPACE_ROOT = resolve(import.meta.dirname, '../../..'); diff --git a/tools/api-report/src/fixer.spec.ts b/tools/api-report/src/fixer.spec.ts index b54fbe96d6..5b26040279 100644 --- a/tools/api-report/src/fixer.spec.ts +++ b/tools/api-report/src/fixer.spec.ts @@ -1,12 +1,13 @@ import { resolve } from 'node:path'; -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { - parseForgottenExportMessage, - resolveSourcePackage, + buildReExportStatement, determineExportKind, findImportModuleForSymbol, - buildReExportStatement, insertReExport, + parseForgottenExportMessage, + resolveSourcePackage, } from './fixer.js'; describe('parseForgottenExportMessage', () => { diff --git a/tools/api-report/src/fixer.ts b/tools/api-report/src/fixer.ts index 44cd02eb6d..db53bb1ffd 100644 --- a/tools/api-report/src/fixer.ts +++ b/tools/api-report/src/fixer.ts @@ -1,5 +1,5 @@ -import { readFileSync, writeFileSync, existsSync } from 'node:fs'; -import { resolve, relative } from 'node:path'; +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import { relative, resolve } from 'node:path'; /** * Extracts the symbol name from an ae-forgotten-export message. diff --git a/tools/api-report/src/integration.spec.ts b/tools/api-report/src/integration.spec.ts index 6d7e30c31e..b707abc624 100644 --- a/tools/api-report/src/integration.spec.ts +++ b/tools/api-report/src/integration.spec.ts @@ -1,9 +1,10 @@ -import { describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { mkdirSync, writeFileSync, readFileSync, rmSync, mkdtempSync } from 'node:fs'; -import { resolve, join } from 'node:path'; +import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; -import { analyzePackage, type PackageInfo } from './main.js'; +import { join, resolve } from 'node:path'; +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; + import { applyFixes } from './fixer.js'; +import { analyzePackage, type PackageInfo } from './main.js'; let FIXTURE_ROOT: string; let CLIENT_DIR: string; diff --git a/tools/api-report/src/main.spec.ts b/tools/api-report/src/main.spec.ts index 9cdd3ff924..6cd163e7cf 100644 --- a/tools/api-report/src/main.spec.ts +++ b/tools/api-report/src/main.spec.ts @@ -1,4 +1,5 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { resolvePackageInfo } from './main.js'; describe('resolvePackageInfo', () => { diff --git a/tools/api-report/src/main.ts b/tools/api-report/src/main.ts index 46b72efbca..b391023676 100644 --- a/tools/api-report/src/main.ts +++ b/tools/api-report/src/main.ts @@ -1,9 +1,10 @@ import { Extractor, type ExtractorMessage } from '@microsoft/api-extractor'; -import { readFileSync, existsSync, mkdirSync } from 'node:fs'; +import { existsSync, mkdirSync, readFileSync } from 'node:fs'; import { resolve } from 'node:path'; -import { resolveEntryPoints, type EntryPoint } from './resolve-entries.js'; + import { buildExtractorConfig } from './config.js'; -import { parseForgottenExportMessage, applyFixes, type ForgottenExport } from './fixer.js'; +import { applyFixes, type ForgottenExport, parseForgottenExportMessage } from './fixer.js'; +import { type EntryPoint, resolveEntryPoints } from './resolve-entries.js'; const WORKSPACE_ROOT = resolve(import.meta.dirname, '../../..'); diff --git a/tools/api-report/src/resolve-entries.spec.ts b/tools/api-report/src/resolve-entries.spec.ts index 6010f71658..6fdd51ea43 100644 --- a/tools/api-report/src/resolve-entries.spec.ts +++ b/tools/api-report/src/resolve-entries.spec.ts @@ -1,4 +1,5 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { resolveEntryPoints } from './resolve-entries.js'; describe('resolveEntryPoints', () => { diff --git a/tools/interface-mapping-validator/package.json b/tools/interface-mapping-validator/package.json index b43637762b..f1caa12d41 100644 --- a/tools/interface-mapping-validator/package.json +++ b/tools/interface-mapping-validator/package.json @@ -15,7 +15,6 @@ }, "dependencies": { "ts-morph": "^28.0.0", - "tsx": "catalog:", "vitest": "catalog:vitest" }, "devDependencies": { diff --git a/tools/interface-mapping-validator/src/differ.test.ts b/tools/interface-mapping-validator/src/differ.test.ts index 0b38f12759..55dfbc79b7 100644 --- a/tools/interface-mapping-validator/src/differ.test.ts +++ b/tools/interface-mapping-validator/src/differ.test.ts @@ -1,7 +1,9 @@ -import { describe, it, expect } from 'vitest'; -import { diff } from './differ.js'; -import type { LegacyExport, NewSdkExport, MarkdownExtractionResult } from './types.js'; +import { describe, expect, it } from 'vitest'; + import { SECTIONS } from './config.js'; +import { diff } from './differ.js'; + +import type { LegacyExport, MarkdownExtractionResult, NewSdkExport } from './types.js'; // --------------------------------------------------------------------------- // Test data helpers diff --git a/tools/interface-mapping-validator/src/differ.ts b/tools/interface-mapping-validator/src/differ.ts index b2b9d599a0..6f83bbbc8b 100644 --- a/tools/interface-mapping-validator/src/differ.ts +++ b/tools/interface-mapping-validator/src/differ.ts @@ -1,3 +1,5 @@ +import { PROTECTED_PREFIXES, SECTIONS } from './config.js'; + import type { Finding, FindingAction, @@ -7,7 +9,6 @@ import type { MarkdownExtractionResult, NewSdkExport, } from './types.js'; -import { PROTECTED_PREFIXES, SECTIONS } from './config.js'; // --------------------------------------------------------------------------- // Helpers diff --git a/tools/interface-mapping-validator/src/extractors/legacy.test.ts b/tools/interface-mapping-validator/src/extractors/legacy.test.ts index fb6f95db0a..7bba8fa90d 100644 --- a/tools/interface-mapping-validator/src/extractors/legacy.test.ts +++ b/tools/interface-mapping-validator/src/extractors/legacy.test.ts @@ -1,5 +1,6 @@ -import { describe, it, expect } from 'vitest'; import { resolve } from 'node:path'; +import { describe, expect, it } from 'vitest'; + import { extractLegacyExports } from './legacy.js'; const FIXTURE_PATH = resolve(__dirname, '../fixtures/legacy-sample.d.ts'); diff --git a/tools/interface-mapping-validator/src/extractors/legacy.ts b/tools/interface-mapping-validator/src/extractors/legacy.ts index 586ab868ef..d61a60c1e7 100644 --- a/tools/interface-mapping-validator/src/extractors/legacy.ts +++ b/tools/interface-mapping-validator/src/extractors/legacy.ts @@ -1,5 +1,6 @@ import { Project } from 'ts-morph'; -import type { LegacyExport, ExportKind } from '../types.js'; + +import type { ExportKind, LegacyExport } from '../types.js'; /** * Extracts all named exports from the legacy SDK's index file using static analysis. diff --git a/tools/interface-mapping-validator/src/extractors/markdown.test.ts b/tools/interface-mapping-validator/src/extractors/markdown.test.ts index f0ae36d236..235c1a94ff 100644 --- a/tools/interface-mapping-validator/src/extractors/markdown.test.ts +++ b/tools/interface-mapping-validator/src/extractors/markdown.test.ts @@ -1,5 +1,6 @@ -import { describe, it, expect } from 'vitest'; import { resolve } from 'node:path'; +import { describe, expect, it } from 'vitest'; + import { extractDocumentedMappings } from './markdown.js'; const FIXTURE_PATH = resolve(__dirname, '../fixtures/sample-mapping.md'); diff --git a/tools/interface-mapping-validator/src/extractors/markdown.ts b/tools/interface-mapping-validator/src/extractors/markdown.ts index 74a66a6290..150b4944ae 100644 --- a/tools/interface-mapping-validator/src/extractors/markdown.ts +++ b/tools/interface-mapping-validator/src/extractors/markdown.ts @@ -1,5 +1,7 @@ import { readFileSync } from 'node:fs'; + import { SECTIONS } from '../config.js'; + import type { DocumentedMapping, MarkdownExtractionResult } from '../types.js'; const IMPORT_SYMBOL_RE = /import\s+(?:type\s+)?{\s*(\w+)\s*}\s+from\s+['"]([^'"]+)['"]/; diff --git a/tools/interface-mapping-validator/src/extractors/new-sdk.test.ts b/tools/interface-mapping-validator/src/extractors/new-sdk.test.ts index b7d900fafc..e34a62d8a5 100644 --- a/tools/interface-mapping-validator/src/extractors/new-sdk.test.ts +++ b/tools/interface-mapping-validator/src/extractors/new-sdk.test.ts @@ -1,5 +1,6 @@ -import { describe, it, expect } from 'vitest'; import { resolve } from 'node:path'; +import { describe, expect, it } from 'vitest'; + import { extractNewSdkExports } from './new-sdk.js'; const FIXTURE_DIR = resolve(__dirname, '../fixtures/mock-package'); diff --git a/tools/interface-mapping-validator/src/extractors/new-sdk.ts b/tools/interface-mapping-validator/src/extractors/new-sdk.ts index 3d8986f780..9c6f21f775 100644 --- a/tools/interface-mapping-validator/src/extractors/new-sdk.ts +++ b/tools/interface-mapping-validator/src/extractors/new-sdk.ts @@ -1,7 +1,8 @@ -import { Project, Node } from 'ts-morph'; -import { readFileSync, existsSync } from 'node:fs'; -import { resolve, join } from 'node:path'; -import type { NewSdkExport, ExportKind } from '../types.js'; +import { existsSync, readFileSync } from 'node:fs'; +import { join, resolve } from 'node:path'; +import { Node, Project } from 'ts-morph'; + +import type { ExportKind, NewSdkExport } from '../types.js'; type PackageExports = Record>; diff --git a/tools/interface-mapping-validator/src/fixer.test.ts b/tools/interface-mapping-validator/src/fixer.test.ts index 1ebe0a1089..873b11c3a8 100644 --- a/tools/interface-mapping-validator/src/fixer.test.ts +++ b/tools/interface-mapping-validator/src/fixer.test.ts @@ -1,7 +1,9 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + +import { SECTIONS } from './config.js'; import { applyFixes } from './fixer.js'; + import type { Finding } from './types.js'; -import { SECTIONS } from './config.js'; const SAMPLE_DOC = `# Interface Mapping diff --git a/tools/interface-mapping-validator/src/fixer.ts b/tools/interface-mapping-validator/src/fixer.ts index 397c10ba1e..260e1069ab 100644 --- a/tools/interface-mapping-validator/src/fixer.ts +++ b/tools/interface-mapping-validator/src/fixer.ts @@ -1,6 +1,7 @@ -import type { Finding } from './types.js'; import { PROTECTED_PREFIXES } from './config.js'; +import type { Finding } from './types.js'; + /** * Find the section heading marker in the lines array for a given section name. * diff --git a/tools/interface-mapping-validator/src/generator.test.ts b/tools/interface-mapping-validator/src/generator.test.ts index 92190c189c..02e097f6aa 100644 --- a/tools/interface-mapping-validator/src/generator.test.ts +++ b/tools/interface-mapping-validator/src/generator.test.ts @@ -1,5 +1,7 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { generateSections } from './generator.js'; + import type { LegacyExport, NewSdkExport, SymbolMapping } from './types.js'; // --------------------------------------------------------------------------- diff --git a/tools/interface-mapping-validator/src/generator.ts b/tools/interface-mapping-validator/src/generator.ts index 900fa497fe..d39a7e4be7 100644 --- a/tools/interface-mapping-validator/src/generator.ts +++ b/tools/interface-mapping-validator/src/generator.ts @@ -1,9 +1,9 @@ import type { + GeneratedSections, LegacyExport, NewSdkExport, - SymbolMapping, RenamedMapping, - GeneratedSections, + SymbolMapping, } from './types.js'; // --------------------------------------------------------------------------- diff --git a/tools/interface-mapping-validator/src/integration.test.ts b/tools/interface-mapping-validator/src/integration.test.ts index 7619856251..c6e8ac4c70 100644 --- a/tools/interface-mapping-validator/src/integration.test.ts +++ b/tools/interface-mapping-validator/src/integration.test.ts @@ -1,22 +1,24 @@ -import { describe, it, expect, beforeAll } from 'vitest'; import { readFileSync } from 'node:fs'; -import { fileURLToPath } from 'node:url'; import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { beforeAll, describe, expect, it } from 'vitest'; + +import { INTERFACE_MAPPING_PATH, LEGACY_SDK_INDEX_PATH, NEW_SDK_PACKAGES } from './config.js'; +import { diff } from './differ.js'; import { extractLegacyExports } from './extractors/legacy.js'; -import { extractNewSdkExports } from './extractors/new-sdk.js'; import { extractDocumentedMappings } from './extractors/markdown.js'; -import { diff } from './differ.js'; -import { formatReport } from './reporter.js'; +import { extractNewSdkExports } from './extractors/new-sdk.js'; import { generateSections } from './generator.js'; +import { PACKAGE_MAP, SYMBOL_MAP } from './mapping-config.js'; +import { formatReport } from './reporter.js'; import { replaceSections } from './writer.js'; -import { SYMBOL_MAP, PACKAGE_MAP } from './mapping-config.js'; + import type { + GeneratedSections, LegacyExport, - NewSdkExport, MarkdownExtractionResult, - GeneratedSections, + NewSdkExport, } from './types.js'; -import { LEGACY_SDK_INDEX_PATH, INTERFACE_MAPPING_PATH, NEW_SDK_PACKAGES } from './config.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/tools/interface-mapping-validator/src/main.ts b/tools/interface-mapping-validator/src/main.ts index 0fcb863378..b615fd3a4a 100644 --- a/tools/interface-mapping-validator/src/main.ts +++ b/tools/interface-mapping-validator/src/main.ts @@ -1,23 +1,24 @@ -import { fileURLToPath } from 'node:url'; -import { dirname, resolve } from 'node:path'; -import { readFileSync, writeFileSync } from 'node:fs'; import { execFileSync } from 'node:child_process'; -import { extractLegacyExports } from './extractors/legacy.js'; -import { extractNewSdkExports } from './extractors/new-sdk.js'; -import { extractDocumentedMappings } from './extractors/markdown.js'; -import { diff } from './differ.js'; -import { applyFixes } from './fixer.js'; -import { formatReport } from './reporter.js'; -import { generateSections } from './generator.js'; -import { replaceSections, replaceMigrationDependencies } from './writer.js'; -import { SYMBOL_MAP, PACKAGE_MAP } from './mapping-config.js'; +import { readFileSync, writeFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + import { - LEGACY_SDK_INDEX_PATH, + CLIENT_PACKAGES, INTERFACE_MAPPING_PATH, + LEGACY_SDK_INDEX_PATH, NEW_SDK_PACKAGES, - CLIENT_PACKAGES, } from './config.js'; +import { diff } from './differ.js'; +import { extractLegacyExports } from './extractors/legacy.js'; +import { extractDocumentedMappings } from './extractors/markdown.js'; +import { extractNewSdkExports } from './extractors/new-sdk.js'; +import { applyFixes } from './fixer.js'; +import { generateSections } from './generator.js'; +import { PACKAGE_MAP, SYMBOL_MAP } from './mapping-config.js'; +import { formatReport } from './reporter.js'; import { validateClientImportsOnly } from './validate-client-imports.js'; +import { replaceMigrationDependencies, replaceSections } from './writer.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/tools/interface-mapping-validator/src/reporter.test.ts b/tools/interface-mapping-validator/src/reporter.test.ts index 5db2f91fd6..a3910b697c 100644 --- a/tools/interface-mapping-validator/src/reporter.test.ts +++ b/tools/interface-mapping-validator/src/reporter.test.ts @@ -1,7 +1,9 @@ -import { describe, it, expect } from 'vitest'; -import type { Finding } from './types.js'; +import { describe, expect, it } from 'vitest'; + import { formatReport } from './reporter.js'; +import type { Finding } from './types.js'; + const makeFinding = (overrides: Partial = {}): Finding => ({ category: 'undocumented-legacy-symbol', severity: 'error', diff --git a/tools/interface-mapping-validator/src/validate-client-imports.spec.ts b/tools/interface-mapping-validator/src/validate-client-imports.spec.ts index 013137644c..179e494e69 100644 --- a/tools/interface-mapping-validator/src/validate-client-imports.spec.ts +++ b/tools/interface-mapping-validator/src/validate-client-imports.spec.ts @@ -1,4 +1,5 @@ -import { describe, it, expect } from 'vitest'; +import { describe, expect, it } from 'vitest'; + import { validateClientImportsOnly } from './validate-client-imports.js'; const ALLOWED_PACKAGES = [ diff --git a/tools/interface-mapping-validator/src/writer.test.ts b/tools/interface-mapping-validator/src/writer.test.ts index 7106637e89..ca37706133 100644 --- a/tools/interface-mapping-validator/src/writer.test.ts +++ b/tools/interface-mapping-validator/src/writer.test.ts @@ -1,5 +1,6 @@ -import { describe, it, expect } from 'vitest'; -import { replaceSections, replaceMigrationDependencies } from './writer.js'; +import { describe, expect, it } from 'vitest'; + +import { replaceMigrationDependencies, replaceSections } from './writer.js'; // --------------------------------------------------------------------------- // Test fixture diff --git a/tools/user-scripts/src/index.ts b/tools/user-scripts/src/index.ts index e5a0907fe9..5d23a09398 100644 --- a/tools/user-scripts/src/index.ts +++ b/tools/user-scripts/src/index.ts @@ -1,4 +1,5 @@ import { Console, Effect } from 'effect'; + import { UserRuntime, UserService } from './lib/user-scripts.js'; export const deleteUser = (userId: string) => diff --git a/tools/user-scripts/src/lib/user-scripts.ts b/tools/user-scripts/src/lib/user-scripts.ts index 18e657634f..504218cb7e 100644 --- a/tools/user-scripts/src/lib/user-scripts.ts +++ b/tools/user-scripts/src/lib/user-scripts.ts @@ -1,6 +1,7 @@ import { HttpClient, HttpClientRequest, HttpClientResponse } from '@effect/platform'; -import { Config, Data, Effect, ManagedRuntime } from 'effect'; import { NodeHttpClient } from '@effect/platform-node'; +import { Config, Data, Effect, ManagedRuntime } from 'effect'; + import { getUsersResponse, TokenResponse } from './schemas.js'; export class UnexpectedStatus extends Data.TaggedError('UnExpectedStatus')<{