@nextad/auction 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var f=(s,i)=>{for(var e in i)u(s,e,{get:i[e],enumerable:!0})},m=(s,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of l(i))!v.call(s,t)&&t!==e&&u(s,t,{get:()=>i[t],enumerable:!(r=h(i,t))||r.enumerable});return s};var g=s=>m(u({},"__esModule",{value:!0}),s);var y={};f(y,{AlreadyEndedAuctionException:()=>a,Auction:()=>B,BidNotFoundException:()=>o});module.exports=g(y);var c=class{static getHighestBidV26(i,e,r){return r?i.reduce((t,n)=>{let d=this.convertPrice(t,e,r);return this.convertPrice(n,e,r)>d?n:t}):i.reduce((t,n)=>{let d=t.price*100;return n.price*100>d?n:t})}static convertPrice(i,e,r){let t=i.price,n=r.conversions[e.get(i)?.currency||"USD"];if(!n)return t*100;let p=n["USD"];return t*(p||1)*100}};var o=class{name="BidNotFoundException";message="Bid is not found."},a=class{name="AlreadyEndedAuctionException";message="Auction is already ended."};var B=class{losingBids;bids;itemIds=[];status;options;bidInformation;constructor(i,e={}){this.options={lossProcessing:!0,...e},this.bids={v26:[]},this.losingBids={v26:[]},this.status="open",this.bidInformation=new WeakMap,typeof i=="string"?this.itemIds.push(i):this.itemIds.push(...i)}getStatus(){return this.status}getLosingBids(){return this.losingBids}getBidInformation(i){return this.bidInformation.get(i)}getBidInformations(){return this.bidInformation}placeBidResponseV26(i){if(i.seatbid){let e=i.seatbid.flatMap(r=>r.bid.map(t=>(this.bidInformation.set(t,{currency:i.cur,version:"2.6",seat:r.seat}),t)));this.bids.v26.push(...e)}return this}end(){if(this.status!=="open")throw new a;if(!this.bids.v26.length)throw new o;let i=c.getHighestBidV26(this.bids.v26,this.bidInformation,this.options.currencyConversionData);return this.setLosingBids(i),this.handleLossBids(),this.status="closed",i}setLosingBids(i){this.losingBids.v26.push(...this.bids.v26.filter(e=>e.id!==i.id))}handleLossBids(){this.losingBids.v26.forEach(i=>{this.handleLossBid(i)})}handleLossBid(i){this.options.lossProcessing&&i.lurl&&fetch(i.lurl,{keepalive:!0})}};0&&(module.exports={AlreadyEndedAuctionException,Auction,BidNotFoundException});
1
+ "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var v=(e,i)=>{for(var s in i)u(e,s,{get:i[s],enumerable:!0})},m=(e,i,s,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of l(i))!f.call(e,t)&&t!==s&&u(e,t,{get:()=>i[t],enumerable:!(r=h(i,t))||r.enumerable});return e};var g=e=>m(u({},"__esModule",{value:!0}),e);var y={};v(y,{AlreadyEndedAuctionException:()=>a,Auction:()=>B,BidNotFoundException:()=>o});module.exports=g(y);var c=class{static getHighestBidV26(i,s,r){return r?i.reduce((t,n)=>{let d=this.convertPrice(t,s,r);return this.convertPrice(n,s,r)>d?n:t}):i.reduce((t,n)=>{let d=t.price*100;return n.price*100>d?n:t})}static convertPrice(i,s,r){let t=i.price,n=r.conversions[s.get(i)?.currency||"USD"];if(!n)return t*100;let p=n["USD"];return t*(p||1)*100}};var o=class{name="BidNotFoundException";message="Bid is not found."},a=class{name="AlreadyEndedAuctionException";message="Auction is already ended."};var B=class{losingBids;bids;itemIds=[];status;options;bidInformation;constructor(i,s={}){this.options={lossProcessing:!0,...s},this.bids={v26:[]},this.losingBids={v26:[]},this.status="open",this.bidInformation=new WeakMap,typeof i=="string"?this.itemIds.push(i):this.itemIds.push(...i)}getStatus(){return this.status}getLosingBids(){return this.losingBids}getBidInformation(i){return this.bidInformation.get(i)}getBidInformations(){return this.bidInformation}placeBidResponseV26(i){if(i.seatbid){let s=i.seatbid.flatMap(r=>r.bid.filter(t=>this.itemIds.some(n=>n===t.impid)).map(t=>(this.bidInformation.set(t,{currency:i.cur,version:"2.6",seat:r.seat}),t)));this.bids.v26.push(...s)}return this}end(){if(this.status!=="open")throw new a;if(!this.bids.v26.length)throw new o;let i=c.getHighestBidV26(this.bids.v26,this.bidInformation,this.options.currencyConversionData);return this.setLosingBids(i),this.handleLossBids(),this.status="closed",i}setLosingBids(i){this.losingBids.v26.push(...this.bids.v26.filter(s=>s.id!==i.id))}handleLossBids(){this.losingBids.v26.forEach(i=>{this.handleLossBid(i)})}handleLossBid(i){this.options.lossProcessing&&i.lurl&&fetch(i.lurl,{keepalive:!0})}};0&&(module.exports={AlreadyEndedAuctionException,Auction,BidNotFoundException});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var o=class{static getHighestBidV26(i,e,s){return s?i.reduce((t,r)=>{let n=this.convertPrice(t,e,s);return this.convertPrice(r,e,s)>n?r:t}):i.reduce((t,r)=>{let n=t.price*100;return r.price*100>n?r:t})}static convertPrice(i,e,s){let t=i.price,r=s.conversions[e.get(i)?.currency||"USD"];if(!r)return t*100;let p=r["USD"];return t*(p||1)*100}};var a=class{name="BidNotFoundException";message="Bid is not found."},d=class{name="AlreadyEndedAuctionException";message="Auction is already ended."};var u=class{losingBids;bids;itemIds=[];status;options;bidInformation;constructor(i,e={}){this.options={lossProcessing:!0,...e},this.bids={v26:[]},this.losingBids={v26:[]},this.status="open",this.bidInformation=new WeakMap,typeof i=="string"?this.itemIds.push(i):this.itemIds.push(...i)}getStatus(){return this.status}getLosingBids(){return this.losingBids}getBidInformation(i){return this.bidInformation.get(i)}getBidInformations(){return this.bidInformation}placeBidResponseV26(i){if(i.seatbid){let e=i.seatbid.flatMap(s=>s.bid.map(t=>(this.bidInformation.set(t,{currency:i.cur,version:"2.6",seat:s.seat}),t)));this.bids.v26.push(...e)}return this}end(){if(this.status!=="open")throw new d;if(!this.bids.v26.length)throw new a;let i=o.getHighestBidV26(this.bids.v26,this.bidInformation,this.options.currencyConversionData);return this.setLosingBids(i),this.handleLossBids(),this.status="closed",i}setLosingBids(i){this.losingBids.v26.push(...this.bids.v26.filter(e=>e.id!==i.id))}handleLossBids(){this.losingBids.v26.forEach(i=>{this.handleLossBid(i)})}handleLossBid(i){this.options.lossProcessing&&i.lurl&&fetch(i.lurl,{keepalive:!0})}};export{d as AlreadyEndedAuctionException,u as Auction,a as BidNotFoundException};
1
+ var o=class{static getHighestBidV26(i,s,r){return r?i.reduce((t,e)=>{let n=this.convertPrice(t,s,r);return this.convertPrice(e,s,r)>n?e:t}):i.reduce((t,e)=>{let n=t.price*100;return e.price*100>n?e:t})}static convertPrice(i,s,r){let t=i.price,e=r.conversions[s.get(i)?.currency||"USD"];if(!e)return t*100;let p=e["USD"];return t*(p||1)*100}};var a=class{name="BidNotFoundException";message="Bid is not found."},d=class{name="AlreadyEndedAuctionException";message="Auction is already ended."};var u=class{losingBids;bids;itemIds=[];status;options;bidInformation;constructor(i,s={}){this.options={lossProcessing:!0,...s},this.bids={v26:[]},this.losingBids={v26:[]},this.status="open",this.bidInformation=new WeakMap,typeof i=="string"?this.itemIds.push(i):this.itemIds.push(...i)}getStatus(){return this.status}getLosingBids(){return this.losingBids}getBidInformation(i){return this.bidInformation.get(i)}getBidInformations(){return this.bidInformation}placeBidResponseV26(i){if(i.seatbid){let s=i.seatbid.flatMap(r=>r.bid.filter(t=>this.itemIds.some(e=>e===t.impid)).map(t=>(this.bidInformation.set(t,{currency:i.cur,version:"2.6",seat:r.seat}),t)));this.bids.v26.push(...s)}return this}end(){if(this.status!=="open")throw new d;if(!this.bids.v26.length)throw new a;let i=o.getHighestBidV26(this.bids.v26,this.bidInformation,this.options.currencyConversionData);return this.setLosingBids(i),this.handleLossBids(),this.status="closed",i}setLosingBids(i){this.losingBids.v26.push(...this.bids.v26.filter(s=>s.id!==i.id))}handleLossBids(){this.losingBids.v26.forEach(i=>{this.handleLossBid(i)})}handleLossBid(i){this.options.lossProcessing&&i.lurl&&fetch(i.lurl,{keepalive:!0})}};export{d as AlreadyEndedAuctionException,u as Auction,a as BidNotFoundException};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextad/auction",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Kai Miyamoto",
@@ -23,13 +23,6 @@
23
23
  "main": "./dist/index.js",
24
24
  "module": "./dist/index.mjs",
25
25
  "types": "./dist/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "import": "./dist/index.mjs",
29
- "require": "./dist/index.js",
30
- "types": "./dist/index.d.ts"
31
- }
32
- },
33
26
  "files": [
34
27
  "dist",
35
28
  "README.md",