github Sitecore/marketplace-sdk @sitecore-marketplace-sdk/client@0.2.0

Minor Changes

  • ff3ca07: Updated application context response with improved property naming and enhanced type definitions

    🔄 What's Changed in Application Context Response:

    When you call client.query('application.context'), the response now includes updated property names for better clarity:

    New Property Names (Recommended):

    const context = await client.query('application.context');
    
    // ✅ New: resourceAccess (replaces resources)
    context.data.resourceAccess; // Array of resource access information
    
    // ✅ New: extensionPoints (replaces touchpoints)
    context.data.extensionPoints; // Array of available extension points

    Legacy Properties (Still Supported):

    // ⚠️ Deprecated but still works: resources
    context.data.resources; // Still returns resource data
    
    // ⚠️ Deprecated but still works: touchpoints
    context.data.touchpoints; // Still returns extension point data

    📋 Updated Response Structure:

    // Application context now returns both old and new properties
    interface ApplicationContext {
      // Resource access information
      resourceAccess: ApplicationResourceContext[]; // ✅ New name
      resources: ApplicationResourceContext[]; // ⚠️ Deprecated
    
      // Extension points information
      extensionPoints: ApplicationExtensionPointContext[]; // ✅ New name
      touchpoints: ApplicationTouchpointContext[]; // ⚠️ Deprecated
    
      // Other properties remain unchanged
      id: string;
      name: string;
      url: string;
      // ... etc
    }

    ✅ Full Backward Compatibility:

    Your existing code continues to work without any changes:

    • ✅ All existing property access (resources, touchpoints) functions normally
    • ✅ No breaking changes to response structure
    • ✅ Both old and new properties are available in every response
    • ✅ Update at your own pace - no migration pressure

    🚀 Benefits of New Names:

    • resourceAccess: More accurately describes granted access permissions
    • extensionPoints: Better describes integration points in your application
    • Consistency: Aligns with modern naming conventions across Sitecore products
    • Clarity: More descriptive names improve code readability

    📖 Migration Examples:

    // Before (still works)
    const resources = context.data.resources;
    const touchpoints = context.data.touchpoints;
    
    resources.forEach((resource) => {
      console.log(`Access to: ${resource.resourceId}`);
    });
    
    touchpoints.forEach((touchpoint) => {
      console.log(`Extension point: ${touchpoint.touchpointId}`);
    });
    
    // After (recommended for new code)
    const resourceAccess = context.data.resourceAccess;
    const extensionPoints = context.data.extensionPoints;
    
    resourceAccess.forEach((access) => {
      console.log(`Access to: ${access.resourceId}`);
    });
    
    extensionPoints.forEach((point) => {
      console.log(`Extension point: ${point.extensionPointId}`);
    });

    🔧 Recommended Migration Path:

    1. Immediate: No action required - existing code continues working
    2. New Code: Use resourceAccess and extensionPoints for new implementations
    3. Gradual Updates: Update existing code when convenient during regular maintenance
    4. IDE Benefits: New property names provide better IntelliSense and type checking

    This update improves the clarity of your application context data while maintaining complete backward compatibility.

Don't miss a new marketplace-sdk release

NewReleases is sending notifications on new releases.