You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user, I want to change arguments of a base story and either
override the args of the selected story or
create a new story with all set args
The goal is to create a server channel API to communicate with the backend to either edit an existing story or create a new story in an existing story file.
Scenarios
1. Scenario: Editing an existing story
// Just a rough example of the structure of the serverChannel API implementation// It is intended as an indication and not as a given.interfaceData{// The id of the request. It might be simply the story Titleid: string;// The path of the StoryimportPath: string;// The updated list of set argsargs: Record<string,any>;// The exported name of the Story -> This information doesn't exist in the index.json yet.name: string;}exportconstexperimental_serverChannel=async(channel: Channel,options: Options)=>{channel.on(EDIT_STORY,async(data: Data)=>{// Save the new set of arguments into the existing Story// Send an event via server channel to the browser to notify about the success/failure of the operation});returnchannel;};
Requirements
If editing the story is successful, a "success" event should be emitted
If editing the story fails, an "error" event should be emitted
Editing the story file shouldn't change indentation or formatting (we could use recast eventually?!)
Sanitizing the arguments. Make sure malicious code cannot be saved
Make sure different variants of argument mutation are considered and documented
2. Scenario: Saving a new story in an existing story file
// Just a rough example of the structure of the serverChannel API implementation.// It is intended as an indication and not as a given.interfaceData{// The id of the request. It might be simply the story Titleid: string;// The path of the StoryimportPath: string;// The whole list of set argsargs: Record<string,any>;// The new name of the Storyname: string;// The exported name of the base Story -> This information doesn't exist in the index.json yet.baseStoryName: string;}exportconstexperimental_serverChannel=async(channel: Channel,options: Options)=>{channel.on(SAVE_STORY,async(data: Data)=>{// Create a new Story// Send an event via server channel to the browser to notify about the success/failure of the operation});returnchannel;};
Requirements
If saving the new story is successful, a "success" event should be emitted
If saving the new story fails, an "error" event should be emitted
The new story should be saved at the end of the file
Transform the name for the new Story to be a valid variable name (no empty space, ...)
All "settings" of the base story should be copied to the new one (parameters, play, decorators, argTypes, loaders, render, tags) - We don't want to extend the base story in the new one. Instead, the new story should be independent.
The new story should be typed if the base story was typed as well (consider both, type assignment while variable declaration export const StoryName: Type = {...} and type casting export const StoryName = {...} as Type
Saving the story file shouldn't change indentation or formatting (we could use recast eventually?!)
Sanitizing the arguments. Make sure malicious code cannot be saved
valentinpalkovic
changed the title
Create a server channel API to edit the args of a story or to create a new story
[Project: SfC]: Create a server channel API to edit the args of a story or to create a new story
Mar 27, 2024
valentinpalkovic
changed the title
[Project: SfC]: Create a server channel API to edit the args of a story or to create a new story
[Project SfC]: Create a server channel API to edit the args of a story or to create a new story
Mar 27, 2024
As a user, I want to change arguments of a
base
story and eitherThe goal is to create a server channel API to communicate with the backend to either edit an existing story or create a new story in an existing story file.
Scenarios
1. Scenario: Editing an existing story
Requirements
2. Scenario: Saving a new story in an existing story file
Requirements
name
for the new Story to be a valid variable name (no empty space, ...)base
story should be copied to the new one (parameters, play, decorators, argTypes, loaders, render, tags) - We don't want to extend thebase
story in the new one. Instead, the new story should be independent.export const StoryName: Type = {...}
and type castingexport const StoryName = {...} as Type
Abstract
Tasks
The text was updated successfully, but these errors were encountered: