Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

✨ Feature Request: Enhance Session Configuration Defaults #131

Open
1 task done
joepegler opened this issue Nov 24, 2024 · 0 comments
Open
1 task done

✨ Feature Request: Enhance Session Configuration Defaults #131

joepegler opened this issue Nov 24, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@joepegler
Copy link
Collaborator

Feature or Improvement Description

Improve the session configuration defaulting mechanism by: 1. Making the full usage object optional with smart defaults 2. Making usage.used optional with appropriate default value 3. Creating a more comprehensive defaulting system for session parameters 4. Implementing type-safe default application

Benefits & Outcomes

  • Better Developer Experience: Reduce boilerplate when creating sessions
  • Safer Defaults: Provide sensible default values for optional parameters
  • Type Safety: Ensure type safety when applying defaults
  • Flexibility: Allow partial configuration while maintaining functionality
  • Consistency: Standardize how defaults are applied across the SDK

Implementation Ideas

  1. Update Types

    • Make usage object fully optional
    • Make individual usage fields optional
    • Add default type configurations
    • Update related type definitions
  2. Default Values

    • Default usage object: { used: 0, limit?: number }
    • Default usage.used: 0
    • Consider other fields that could benefit from defaults
    • Document default values
  3. Implementation Requirements

    • Create new defaulting utility function
    • Handle nested optional fields
    • Preserve existing values when present
    • Maintain type safety
    • Add validation for default values
  4. Integration Points

    • Update applyDefaults function
    • Modify CreateSessionDataParams interface
    • Update session creation flow
    • Adjust validation logic
  5. Testing Requirements

    • Test full object defaulting
    • Test partial object defaulting
    • Test nested field defaulting
    • Verify type safety
    • Test edge cases

Fields to Default

  • Full usage object when undefined
  • usage.used when parent object exists
  • Consider other optional fields for future expansion

Integration Points

  • grantPermission.ts
  • Types.ts
  • Helpers.ts

References

Any References?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@joepegler joepegler added the enhancement New feature or request label Nov 24, 2024
@joepegler joepegler self-assigned this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant