forked from DAVFoundation/dav-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BidParams.js.map
1 lines (1 loc) · 4.7 KB
/
BidParams.js.map
1
{"version":3,"sources":["../src/BidParams.ts"],"names":[],"mappings":";;AAAA,+CAAwC;AAGxC,mCAA4B;AAC5B,iDAA2C;AAG3C;;GAEG;AACH,eAAwC,SAAQ,qBAAW;IAOzD,YACE,QAAgB,EAChB,IAAY,EACZ,MAA4B;QAE5B,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;SACvB;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;gBACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;aAC9C;YACD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;aAClD;YACD,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAC9B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;YAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;YACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YAC/D,MAAM,WAAW,GACf,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAChE,WAAW,CAAC,GAAG,CACb,CAAC,KAAsB,EAAU,EAAE;gBACjC,OAAO,OAAO,KAAK,KAAK,QAAQ;oBAC9B,CAAC,CAAC,IAAI,eAAK,CAAC,KAAmB,EAAE,wBAAS,CAAC,IAAI,CAAC;oBAChD,CAAC,C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AC,GAAG,KAAK,KAAK,CAAC,GAAG;YACtB,YAAY;YACZ,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;YAClC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,CACvC,CAAC;IACJ,CAAC;CACF;AA3ED,4BA2EC","file":"BidParams.js","sourcesContent":["import BasicParams from './BasicParams';\nimport IPrice from './IPrice';\nimport { ID, BigInteger, DavID } from './common-types';\nimport Price from './Price';\nimport { PriceType } from './common-enums';\nimport IBidParams from './IBidParams';\n\n/**\n * @class The abstract Class BidParams represent common parameters of BidParams classes.\n */\nexport default abstract class BidParams extends BasicParams {\n public id: ID;\n public price: IPrice[];\n public vehicleId: DavID;\n public neederDavId: DavID;\n public isCommitted: boolean;\n\n public constructor(\n protocol: string,\n type: string,\n values?: Partial<IBidParams>,\n ) {\n if (!values) {\n super(protocol, type);\n } else {\n if (!values.price) {\n throw new Error('price is a required field');\n }\n if (!values.vehicleId) {\n throw new Error('vehicleId is a required field');\n }\n super(protocol, type, values);\n this.id = values.id;\n this.vehicleId = values.vehicleId;\n this.neederDavId = values.neederDavId;\n this.isCommitted = values.isCommitted === false ? false : true;\n const priceObject =\n values.price instanceof Array ? values.price : [values.price];\n priceObject.map(\n (price: string | IPrice): IPrice => {\n return typeof price === 'string'\n ? new Price(price as BigInteger, PriceType.flat)\n : new Price(price.value, price.type, price.description);\n },\n );\n this.price = priceObject as IPrice[];\n }\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n Object.assign(formattedParams, {\n id: this.id,\n price: this.price,\n vehicleId: this.vehicleId,\n neederDavId: this.neederDavId,\n isCommitted: this.isCommitted,\n });\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n this.id = json.id;\n this.price = json.price;\n this.vehicleId = json.vehicleId;\n this.neederDavId = json.neederDavId;\n this.isCommitted = json.isCommitted;\n }\n\n public equals(other: BidParams): boolean {\n const isPriceEqual =\n this.price\n .map(\n (price, index) =>\n other.price[index] && price.equals(other.price[index]),\n )\n .find((x: any) => !x) === undefined;\n return (\n this.ttl === other.ttl &&\n isPriceEqual &&\n this.vehicleId === other.vehicleId &&\n this.neederDavId === other.neederDavId\n );\n }\n}\n"]}