@@ -2,18 +2,14 @@ import {FlagQualifier} from "../qualifiers/flag/FlagQualifier.js";
22import { Qualifier } from "./qualifier/Qualifier.js" ;
33import { mapToSortedArray } from "./utils/dataStructureUtils.js" ;
44import { FlagTypes } from "../types/types.js" ;
5- import { IActionModel } from "./models/IActionModel.js" ;
6- import { IErrorObject } from "./models/IErrorObject.js" ;
7- import { createUnsupportedError } from "./utils/unsupportedError.js" ;
5+ import { ActionModel } from "./models/ActionModel.js" ;
86
97/**
108 * @summary SDK
119 * @memberOf SDK
1210 * @description Defines the category of transformation to perform.
1311 */
14- class Action {
15- protected _actionModel : IActionModel = { } ; // Action model representation
16-
12+ class Action extends ActionModel {
1713 // We're using map, to overwrite existing keys. for example:
1814 // addParam(w_100).addQualifier(w_200) should result in w_200. and not w_100,w_200
1915 qualifiers : Map < string , Qualifier > = new Map ( ) ;
@@ -23,7 +19,8 @@ class Action {
2319 // So flags are stored separately until the very end because of that reason
2420 flags : FlagQualifier [ ] = [ ] ;
2521 private delimiter = ',' ; // {qualifier}{delimiter}{qualifier} for example: `${'w_100'}${','}${'c_fill'}`
26- protected prepareQualifiers ( ) :void { }
22+ protected prepareQualifiers ( ) : void { }
23+
2724 private actionTag = '' ; // A custom name tag to identify this action in the future
2825
2926 /**
@@ -38,7 +35,7 @@ class Action {
3835 * @description Sets the custom name tag for this action
3936 * @return {this }
4037 */
41- setActionTag ( tag :string ) : this {
38+ setActionTag ( tag : string ) : this {
4239 this . actionTag = tag ;
4340 return this ;
4441 }
@@ -96,15 +93,7 @@ class Action {
9693 return this ;
9794 }
9895
99- toJson ( ) : IActionModel | IErrorObject {
100- if ( this . _actionModel . actionType ) {
101- return this . _actionModel ;
102- }
103-
104- return { error : createUnsupportedError ( `unsupported action ${ this . constructor . name } ` ) } ;
105- }
106-
107- protected addValueToQualifier ( qualifierKey : string , qualifierValue : any ) : this{
96+ protected addValueToQualifier ( qualifierKey : string , qualifierValue : any ) : this {
10897 this . qualifiers . get ( qualifierKey ) . addValue ( qualifierValue ) ;
10998
11099 return this ;
0 commit comments