@apistudio/apim-cli
Version:
CLI for API Management Products
144 lines (126 loc) • 4.44 kB
text/typescript
import { Metadata } from "../../common/models/base-asset.model.js";
import { VCSFileInfo } from "../../vcs/models/vcs-file-info.model.js";
interface DependentAsset {
[key: string]: {
ref: string,
data: string,
fileHandle: FileSystemFileHandle | VCSFileInfo,
project: string
}
}
export interface PolicySeqAction {
/**
* Updates active policy sequence for the form view
* @param fileHandle Policy sequence file handle
* @returns
*/
setActivePolicySeq: (fileHandle: FileSystemFileHandle | VCSFileInfo) => Promise<void>;
/**
* Updates active policy for the active policy sequence
* @param fileHandle Policy file handle
* @returns
*/
setActivePolicy: (fileHandle: FileSystemFileHandle | VCSFileInfo) => Promise<void>;
/**
* sets active stage of the active policy sequence
* @param stage Stage of policy sequence
* @returns
*/
setActiveStage: (stage: string) => void;
/**
* Adds a new policy to the active stage of active policy sequence,
* - a new file is not created through this operation
* @param metadata metadata of the new policy file
* @param fileHandle filehandle of the new policy file
* @returns
*/
addNewPolicy: (metadata: Metadata, fileHandle: FileSystemFileHandle | VCSFileInfo) => Promise<void>;
/**
* Adds an existing policy to the active stage of active policy sequence
* @param metadata metadata of the existing policy file
* @returns
*/
addExistingPolicy: (metadata: Metadata) => Promise<void>;
/**
* Removes an existing policy from the active stage of active policy sequence
* @param metadata metadata of the existing policy file
* @returns
*/
removePolicy: (metadata: Metadata) => Promise<void>;
/**
* Updates the list of policies of active stage with the list of policies passed in as parameter
* @param policies List of metadata of policies of the active stage
* @returns
*/
updateStagePolicies: (policies: Metadata[]) => Promise<void>;
/**
* Updates policy file content with the object given as parameter
* @param policy Policy Object
* @returns
*/
updatePolicy: <T>(policy: T) => Promise<void>;
/**
* Updates asset file content with the object given as parameter
* @param asset Asset object
* @param key Dependent asset key
* @returns
*/
updateDependentAsset: <T>(asset: T, key: string) => Promise<DependentAsset>;
/**
* Sets active dependent asset of the active policy
* @param fileHandle Asset file handle
* @param key unique key for the asset
* @param projectName name of the project where the dependent asset resides in
* @returns
*/
setActiveDependentAsset: (fileHandle: FileSystemFileHandle | VCSFileInfo, projectName: string, key: string) => Promise<DependentAsset>;
/**
* Removes dependent asset from store
* @returns
*/
removeDependentAsset: () => void;
/**
* Empties store
* @returns
*/
resetStore: () => void;
}
export interface PolicyAction {
/**
* Updates active policy for the active policy sequence
* @param fileHandle Policy file handle
* @returns
*/
setActivePolicy: (fileHandle: FileSystemFileHandle | VCSFileInfo) => Promise<void>;
/**
* Updates policy file content with the object given as parameter
* @param policy Policy Object
* @returns
*/
updatePolicy: <T>(policy: T) => Promise<void>;
/**
* Updates asset file content with the object given as parameter
* @param asset Asset object
* @param key Dependent asset key
* @returns
*/
updateDependentAsset: <T>(asset: T, key: string) => Promise<DependentAsset>;
/**
* Sets active dependent asset of the active policy
* @param fileHandle Asset file handle
* @param key unique key for the asset
* @param projectName name of the project where the dependent asset resides in
* @returns
*/
setActiveDependentAsset: (fileHandle: FileSystemFileHandle | VCSFileInfo, projectName: string, key: string) => Promise<DependentAsset>;
/**
* Removes dependent asset from store
* @returns
*/
removeDependentAsset: () => void;
/**
* Empties store
* @returns
*/
resetStore: () => void;
}