Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/app/src/cli/models/extensions/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ export type ExtensionFeature =

export type TransformationConfig = Record<string, string>

/**
* Options for converting platform content to the local format.
*
* `handle` is the module handle. Some modules keep it outside their config, so the config alone can't restore it.
*/
export interface RemoteToLocalTransformOptions {
flags?: Flag[]
handle?: string
}

export interface CustomTransformationConfig {
forward?: (obj: object, appConfiguration: AppConfiguration, options?: {flags?: Flag[]}) => object
reverse?: (obj: object, options?: {flags?: Flag[]}) => object
reverse?: (obj: object, options?: RemoteToLocalTransformOptions) => object
}

type ExtensionExperience = 'extension' | 'configuration'
Expand Down Expand Up @@ -119,7 +129,7 @@ export interface ExtensionSpecification<TConfiguration extends BaseConfigType =
* @param options - Additional options to be used in the transformation
* @returns Transformed configuration to use in place of the platform provided content
*/
transformRemoteToLocal?: (remoteContent: object, options?: {flags?: Flag[]}) => object
transformRemoteToLocal?: (remoteContent: object, options?: RemoteToLocalTransformOptions) => object

uidStrategy: UidStrategy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const EventsSpecIdentifier = 'events'

const EventsTransformConfig: CustomTransformationConfig = {
forward: transformFromEventsConfig,
reverse: (content: object) => transformToEventsConfig(content),
reverse: transformToEventsConfig,
}

const EventsSchema = BaseSchemaWithoutHandle.extend({
Expand Down
Loading
Loading