[Feature] Implement Multiton Pattern for Enhanced Instance Management in AsgardeoAuthClient
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
調査の方向性
まず、@asgardeo/javascript パッケージ内の AsgardeoAuthClient を探し、issue で参照されているブラウザー固有の SDK 実装を確認します。保護された構築、ID をキーとしたインスタンス取得、ライフサイクルのクリーンアップに必要な設計を確認します。完了の条件は、getInstance、destroyInstance、destroyAllInstances、hasInstance が分離されたクライアントとクリーンなテスト状態をサポートすることです。
索引モデルが issue の本文から書いたものです。
説明
Current Limitation
The AsgardeoAuthClient currently relies on a public constructor, allowing for the uncontrolled creation of multiple instances without a centralized management system. Unlike the browser-specific implementations in the SDK ecosystem, there is no static mechanism to track, retrieve, or properly dispose of active client instances.
This lack of lifecycle management creates several issues:
- Inconsistency: It diverges from the architectural patterns used elsewhere in the SDK, leading to a fragmented developer experience.
- Resource Management: There is no standard way to destroy an instance or clear its session data, which poses risks for memory leaks.
- Multi-tenancy issues: Applications needing multiple isolated authentication contexts (e.g., distinct organization sessions) have no reliable way to manage and access specific instances by ID.
- Testing challenges: Without a way to destroyAllInstances(), ensuring a clean state between unit tests is difficult.
Suggested Improvement
Refactor the AsgardeoAuthClient to implement the Multiton Pattern. This involves restricting direct instantiation and managing instances via a static internal map.
Specific changes recommended:
- Protected Constructor: Change the constructor visibility to protected to prevent direct usage of new AsgardeoAuthClient().
- Static Instance Map: Introduce a static Map<number, AsgardeoAuthClient> to store active instances.
- Factory Method: Implement a static getInstance(id?: number) method that creates a new instance only if one does not exist for the given ID.
- Lifecycle Methods: Add utility methods to support proper cleanup:
- destroyInstance(id)
- destroyAllInstances()
- hasInstance(id)
Please select the package issue is related to
@asgardeo/javascript
Version
N/A
Reporter Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided all the necessary information.
- I have verified the improvement is not available in the latest version of the package.
- 主要言語
- TypeScript
- スター
- 18
- フォーク
- 67
- 平均マージ
- 3時間 40分
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
asgardeo/javascript のほかの issue
-
Bug: SignInButton render prop usage in "react-tanstack-router" sample missing "onClick={signIn}"対応中かも @KavishkaVenuka が 15 日前に担当しました。 オープンType/Bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
asgardeo/javascript#572 ·
メンテナーはふだん 1 日以内に返信
-
Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
asgardeo/javascript#571 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
asgardeo/javascript#485 ·
メンテナーはふだん 1 日以内に返信
-
signInSilently() always resolves false: getAuthorizeRequestUrlParams overwrites the "sign-in-silently" state with instance_<id>対応中かも @Dumindu-Kanchana が 5 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
asgardeo/javascript#577 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
asgardeo/javascript#527 ·
メンテナーはふだん 1 日以内に返信
asgardeo/javascript の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
solana-foundation/solana-com#2245 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
`document.cookie` with `max-age=0` does not delete the cookie対応中かも @BartInTheField が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
capricorn86/happy-dom#2460 ·
メンテナーはふだん 2 日以内に返信