b23-lib 3.9.1 → 3.9.2
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/Classes/Address.d.mts +1 -1
- package/dist/Classes/Address.d.ts +1 -1
- package/dist/Classes/Base.d.mts +1 -1
- package/dist/Classes/Base.d.ts +1 -1
- package/dist/Classes/Cart.d.mts +2 -2
- package/dist/Classes/Cart.d.ts +2 -2
- package/dist/Classes/Charge.d.mts +1 -1
- package/dist/Classes/Charge.d.ts +1 -1
- package/dist/Classes/Common.d.mts +1 -1
- package/dist/Classes/Common.d.ts +1 -1
- package/dist/Classes/Coupon.d.mts +1 -1
- package/dist/Classes/Coupon.d.ts +1 -1
- package/dist/Classes/Customer.d.mts +1 -1
- package/dist/Classes/Customer.d.ts +1 -1
- package/dist/Classes/CustomerAddress.d.mts +1 -1
- package/dist/Classes/CustomerAddress.d.ts +1 -1
- package/dist/Classes/Inventory.d.mts +2 -2
- package/dist/Classes/Inventory.d.ts +2 -2
- package/dist/Classes/Invoice.d.mts +2 -2
- package/dist/Classes/Invoice.d.ts +2 -2
- package/dist/Classes/LineItem.d.mts +2 -2
- package/dist/Classes/LineItem.d.ts +2 -2
- package/dist/Classes/Order.d.mts +2 -2
- package/dist/Classes/Order.d.ts +2 -2
- package/dist/Classes/Payment.d.mts +1 -1
- package/dist/Classes/Payment.d.ts +1 -1
- package/dist/Classes/Price.d.mts +1 -1
- package/dist/Classes/Price.d.ts +1 -1
- package/dist/Classes/Product.d.mts +2 -2
- package/dist/Classes/Product.d.ts +2 -2
- package/dist/Classes/ShoppingContainer.d.mts +2 -2
- package/dist/Classes/ShoppingContainer.d.ts +2 -2
- package/dist/Classes/TaxRule.d.mts +1 -1
- package/dist/Classes/TaxRule.d.ts +1 -1
- package/dist/Classes/TieredPrice.d.mts +2 -2
- package/dist/Classes/TieredPrice.d.ts +2 -2
- package/dist/{Common-BtMFh79I.d.ts → Price-CM028BEC.d.ts} +80 -80
- package/dist/{Common-BqhQxCq8.d.mts → Price-DhE6HC9v.d.mts} +80 -80
- package/dist/{Product-mtVUKzNI.d.ts → TieredPrice-BYCsK-r6.d.ts} +113 -113
- package/dist/{Product-BywRotdH.d.mts → TieredPrice-Da5vsB_9.d.mts} +113 -113
- package/dist/index.d.mts +94 -2
- package/dist/index.d.ts +94 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {b as b$
|
|
2
|
-
export{
|
|
1
|
+
import {b as b$3}from'./chunk-AMIRIUMH.mjs';export{d as Fetch,b as Logger,c as ResponseUtility}from'./chunk-AMIRIUMH.mjs';import {f,b as b$2}from'./chunk-7B5TAYNA.mjs';export{a as Utils}from'./chunk-7B5TAYNA.mjs';import'./chunk-7RAIVZKB.mjs';import'./chunk-UIQH5QIR.mjs';import {q,j,a,b as b$1,c,d as d$1}from'./chunk-PL5HGCWN.mjs';import'./chunk-O6BLQQO7.mjs';import'./chunk-UXZBULDS.mjs';var m={$id:"standards",definitions:{lowercaseText:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]*$"},lowercaseText10:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]{0,10}$"},lowercaseText16:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]{0,16}$"},lowercaseText30:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]{0,30}$"},lowercaseText50:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]{0,50}$"},lowercaseText256:{type:"string",pattern:"^(?!\\s)(?!.*\\s$)[a-z]{0,256}$"},text:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).*$"},text10:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{0,10}$"},text16:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{0,16}$"},text30:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{0,30}$"},text50:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{0,50}$"},text256:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{0,256}$"},requiredText:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).+$"},requiredText10:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{1,10}$"},requiredText16:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{1,16}$"},requiredText30:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{1,30}$"},requiredText50:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{1,50}$"},requiredText256:{type:"string",pattern:"^(?!\\s)(?!.*\\s$).{1,256}$"},url:{type:"string",pattern:"^https://[^\\s/$.?#].[^\\s]*$",maxLength:2048},uuid:{type:"string",minLength:1,pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},productKey:{type:"string",pattern:f.productKeyRegex.source},productSku:{type:"string",pattern:f.productSKURegex.source},productType:{type:"string",enum:Object.values(q)},genderCategory:{type:"string",enum:Object.values(j)},price:{type:"object",properties:{amount:{type:"number",minimum:0},currency:{$ref:"#/definitions/currency"}},additionalProperties:!1,required:["amount","currency"]},color:{type:"object",properties:{name:{type:"string"},hex:{type:"string"}},additionalProperties:!1,required:["name"]},attributeValue:{oneOf:[{type:"string"},{$ref:"#/definitions/color"}]},selectionAttributes:{type:"object",properties:{color:{$ref:"#/definitions/color"}},required:["color"],additionalProperties:{$ref:"#/definitions/attributeValue"}},firstName:{$ref:"#/definitions/requiredText30"},lastName:{$ref:"#/definitions/text30"},company:{$ref:"#/definitions/text50"},phone:{type:"string",pattern:"^[0-9]{10}$"},e164Phone:{type:"string",pattern:"^\\+[1-9]\\d{1,14}$"},email:{type:"string",pattern:"^[^\\s]+@[^\\s]+\\.[^\\s]+$"},addressLine1:{$ref:"#/definitions/requiredText50"},addressLine2:{$ref:"#/definitions/text50"},city:{$ref:"#/definitions/requiredText30"},postalCode:{$ref:"#/definitions/requiredText16"},state:{type:"string",enum:["AP","AR","AS","BR","CT","GA","GJ","HR","HP","JH","KA","KL","MP","MH","MN","ML","MZ","NL","OR","PB","RJ","SK","TN","TG","TR","UP","UT","WB","AN","CH","DH","LD","DL","PY","LA","JK"]},country:{type:"string",enum:Object.values(a)},currency:{type:"string",enum:Object.values(b$1)},locale:{type:"string",enum:Object.values(c)},language:{type:"string",enum:Object.values(d$1)},localeOrLanguage:{type:"string",enum:[...Object.values(c),...Object.values(d$1)]},addressType:{type:"string",enum:["shipping","billing","billing&shipping"]},address:{type:"object",properties:{firstName:{$ref:"standards#/definitions/firstName"},lastName:{$ref:"standards#/definitions/lastName"},company:{$ref:"standards#/definitions/company"},phone:{$ref:"standards#/definitions/phone"},email:{$ref:"standards#/definitions/email"},addressLine1:{$ref:"standards#/definitions/addressLine1"},addressLine2:{$ref:"standards#/definitions/addressLine2"},city:{$ref:"standards#/definitions/city"},postalCode:{$ref:"standards#/definitions/postalCode"},state:{$ref:"standards#/definitions/state"},country:{$ref:"standards#/definitions/country"}},required:["firstName","lastName","phone","email","addressLine1","postalCode","state","country"]}}};var g={pricingType:{enum:Object.values(b$2)},tier:{type:"object",properties:{enabled:{type:"boolean"},minQuantity:{type:"integer",minimum:1},unitPrice:{$ref:"standards#/definitions/price"}},required:["minQuantity","unitPrice"]},volumeTieredPrice:{type:"object",properties:{type:{const:"volume"},currency:{$ref:"standards#/definitions/currencyCode"},baseUnitPrice:{$ref:"standards#/definitions/price"},taxCategory:{$ref:"standards#/definitions/requiredText"},isTaxInclusive:{type:"boolean"},tiers:{type:"array",items:{$ref:"#/definitions/tier"}}},required:["taxCategory","baseUnitPrice"]},selectionTieredPrice:{type:"object",properties:{type:{const:"selection"},currency:{$ref:"standards#/definitions/currencyCode"},taxCategory:{$ref:"standards#/definitions/requiredText"},isTaxInclusive:{type:"boolean"},selections:{type:"array",items:{type:"object",properties:{selectionAttributes:{$ref:"standards#/definitions/selectionAttributes"},baseUnitPrice:{$ref:"standards#/definitions/price"},tiers:{type:"array",items:{$ref:"#/definitions/tier"}}},required:["selectionAttributes","baseUnitPrice"]}}},required:["type","taxCategory","currency"]},tieredPrice:{anyOf:[{$ref:"#/definitions/volumeTieredPrice"},{$ref:"#/definitions/selectionTieredPrice"}]}};var b={getStandardSchemaDefinition(){return m},TieredPriceSchema:g},T=b;var d=class{cache=new Map;maxSize;ttl;cleanupInterval;constructor(e=1e3,t=5*60*1e3){if(!Number.isFinite(e)||e<1)throw new RangeError("maxSize must be a finite number greater than or equal to 1.");if(!Number.isFinite(t)||t<1)throw new RangeError("ttl must be a finite number greater than or equal to 1.");this.maxSize=e,this.ttl=t,this.cleanupInterval=setInterval(()=>this.cleanup(),60*1e3),this.cleanupInterval.unref&&this.cleanupInterval.unref();}cleanup(){let e=Date.now();for(let[t,r]of this.cache.entries())e>=r.expiry&&this.cache.delete(t);}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r);}this.cache.set(e,{value:t,expiry:Date.now()+this.ttl});}get(e){let t=this.cache.get(e);if(t){if(Date.now()>=t.expiry){this.cache.delete(e);return}return this.cache.delete(e),b$3.logMessage("MemoryCache.get",`Successfully read cache data for key: ${e}`),this.cache.set(e,t),t.value}}dispose(){clearInterval(this.cleanupInterval);}},v=d;
|
|
2
|
+
export{v as MemoryCache,T as Schema};//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Schema/definition.ts","../src/Schema/index.ts","../src/MemoryCache/index.ts"],"names":["definition_default","ProductModel","ProductType","GenderCategory","OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","Schema","Schema_default","MemoryCache","maxSize","ttl","now","key","item","value","firstKey","Logger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,IAAMC,EAAO,IAAK,CAAA,KAAA,CAAM,IAAID,CAAG,CAAA,CAC/B,GAAKC,CAAAA,CACL,IAAI,IAAK,CAAA,GAAA,IAASA,CAAK,CAAA,MAAA,CAAQ,CAC3B,IAAK,CAAA,KAAA,CAAM,OAAOD,CAAG,CAAA,CACrB,MACJ,CACA,OAAA,IAAA,CAAK,MAAM,MAAOA,CAAAA,CAAG,EACrBI,GAAO,CAAA,UAAA,CAAW,kBAAmB,CAAyCJ,sCAAAA,EAAAA,CAAG,EAAE,CACnF,CAAA,IAAA,CAAK,MAAM,GAAIA,CAAAA,CAAAA,CAAKC,CAAI,CACjBA,CAAAA,CAAAA,CAAK,MAChB,CAMA,OAAA,EAAU,CACN,aAAc,CAAA,IAAA,CAAK,eAAe,EACtC,CACJ,EAEOI,CAAQT,CAAAA","file":"index.mjs","sourcesContent":["import { GenderCategory, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, ProductType } from \"../Classes/Enum\";\r\nimport ProductModel from \"../Classes/Product\";\r\n\r\nexport default {\r\n \"$id\": \"standards\",\r\n \"definitions\": {\r\n \"lowercaseText\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]*$\"\r\n },\r\n \"lowercaseText10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,10}$\"\r\n },\r\n \"lowercaseText16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,16}$\"\r\n },\r\n \"lowercaseText30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,30}$\"\r\n },\r\n \"lowercaseText50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,50}$\"\r\n },\r\n \"lowercaseText256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,256}$\"\r\n },\r\n \"text\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).*$\"\r\n },\r\n \"text10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,10}$\"\r\n },\r\n \"text16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,16}$\"\r\n },\r\n \"text30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,30}$\"\r\n },\r\n \"text50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,50}$\"\r\n },\r\n \"text256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,256}$\"\r\n },\r\n \"requiredText\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).+$\"\r\n },\r\n \"requiredText10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,10}$\"\r\n },\r\n \"requiredText16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,16}$\"\r\n },\r\n \"requiredText30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,30}$\"\r\n },\r\n \"requiredText50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,50}$\"\r\n },\r\n \"requiredText256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,256}$\"\r\n },\r\n \"url\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^https://[^\\\\s/$.?#].[^\\\\s]*$\",\r\n \"maxLength\": 2048\r\n },\r\n \"uuid\": {\r\n \"type\": \"string\",\r\n \"minLength\": 1,\r\n \"pattern\": \"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\"\r\n },\r\n \"productKey\": {\r\n \"type\": \"string\",\r\n \"pattern\": ProductModel.productKeyRegex.source\r\n },\r\n \"productSku\": {\r\n \"type\": \"string\",\r\n \"pattern\": ProductModel.productSKURegex.source\r\n },\r\n \"productType\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(ProductType)\r\n },\r\n \"genderCategory\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(GenderCategory)\r\n },\r\n \"price\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"amount\": { \"type\": \"number\", \"minimum\": 0 },\r\n \"currency\": { \"$ref\": \"#/definitions/currency\" }\r\n },\r\n \"additionalProperties\": false,\r\n \"required\": [\"amount\", \"currency\"]\r\n },\r\n \"color\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"type\": \"string\"\r\n },\r\n \"hex\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"additionalProperties\": false,\r\n \"required\": [\r\n \"name\"\r\n ]\r\n },\r\n \"attributeValue\": {\r\n \"oneOf\": [\r\n { \"type\": \"string\" },\r\n {\r\n \"$ref\": \"#/definitions/color\"\r\n }\r\n ]\r\n },\r\n \"selectionAttributes\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"color\": { \"$ref\": \"#/definitions/color\" }\r\n },\r\n \"required\": [\"color\"],\r\n \"additionalProperties\": {\r\n \"$ref\": \"#/definitions/attributeValue\"\r\n }\r\n },\r\n \"firstName\": { \"$ref\": \"#/definitions/requiredText30\" },\r\n \"lastName\": { \"$ref\": \"#/definitions/text30\" },\r\n \"company\": { \"$ref\": \"#/definitions/text50\" },\r\n \"phone\": { \r\n \"type\" : \"string\",\r\n \"pattern\": \"^[0-9]{10}$\"\r\n },\r\n \"e164Phone\": {\r\n \"type\" : \"string\",\r\n \"pattern\": \"^\\\\+[1-9]\\\\d{1,14}$\"\r\n },\r\n \"email\": { \r\n \"type\" : \"string\",\r\n \"pattern\": \"^[^\\\\s]+@[^\\\\s]+\\\\.[^\\\\s]+$\"\r\n },\r\n \"addressLine1\": { \"$ref\": \"#/definitions/requiredText50\" },\r\n \"addressLine2\": { \"$ref\": \"#/definitions/text50\" },\r\n \"city\": { \"$ref\": \"#/definitions/requiredText30\" },\r\n \"postalCode\": { \"$ref\": \"#/definitions/requiredText16\" },\r\n \"state\": {\r\n \"type\": \"string\",\r\n \"enum\": [\"AP\", \"AR\", \"AS\", \"BR\", \"CT\", \"GA\", \"GJ\", \"HR\", \"HP\", \"JH\", \"KA\", \"KL\", \"MP\", \"MH\", \"MN\", \"ML\", \"MZ\", \"NL\", \"OR\", \"PB\", \"RJ\", \"SK\", \"TN\", \"TG\", \"TR\", \"UP\", \"UT\", \"WB\", \"AN\", \"CH\", \"DH\", \"LD\", \"DL\", \"PY\", \"LA\", \"JK\"]\r\n },\r\n \"country\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalCountry)\r\n },\r\n \"currency\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalCountryCurrency)\r\n },\r\n \"locale\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalLocale)\r\n },\r\n \"language\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalLanguage)\r\n },\r\n \"localeOrLanguage\": {\r\n \"type\": \"string\",\r\n \"enum\": [...Object.values(OperationalLocale), ...Object.values(OperationalLanguage)]\r\n },\r\n \"addressType\": {\r\n \"type\": \"string\",\r\n \"enum\": [\"shipping\", \"billing\", \"billing&shipping\"]\r\n },\r\n \"address\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\"$ref\": \"standards#/definitions/firstName\"},\r\n \"lastName\": { \"$ref\": \"standards#/definitions/lastName\" },\r\n \"company\": { \"$ref\": \"standards#/definitions/company\" },\r\n \"phone\": { \"$ref\": \"standards#/definitions/phone\" },\r\n \"email\": { \"$ref\": \"standards#/definitions/email\" },\r\n \"addressLine1\": { \"$ref\": \"standards#/definitions/addressLine1\" },\r\n \"addressLine2\": { \"$ref\": \"standards#/definitions/addressLine2\" },\r\n \"city\": { \"$ref\": \"standards#/definitions/city\" },\r\n \"postalCode\": { \"$ref\": \"standards#/definitions/postalCode\" },\r\n \"state\": { \"$ref\": \"standards#/definitions/state\" },\r\n \"country\": { \"$ref\": \"standards#/definitions/country\" }\r\n },\r\n \"required\": [\"firstName\", \"lastName\", \"phone\", \"email\", \"addressLine1\", \"postalCode\", \"state\", \"country\"]\r\n }\r\n }\r\n}","import SchemaDefinitions from './definition';\r\n\r\nconst Schema = {\r\n getStandardSchemaDefinition() {\r\n return SchemaDefinitions;\r\n }\r\n}\r\n\r\nexport default Schema;\r\n","import Logger from \"../Logger\";\r\n\r\n/**\r\n * In-memory cache with per-entry TTL expiration and LRU-style eviction.\r\n *\r\n * Keys are `string` and values are generic (`T`).\r\n * Expired entries are removed lazily on `get` and periodically by a cleanup timer.\r\n */\r\nclass MemoryCache<T> {\r\n private cache: Map<string, { value: T; expiry: number }> = new Map();\r\n private maxSize: number;\r\n private ttl: number;\r\n private cleanupInterval: ReturnType<typeof setInterval>;\r\n\r\n /**\r\n * Creates a cache instance.\r\n *\r\n * @param maxSize Maximum number of live entries allowed in cache. Must be >= 1.\r\n * @param ttl Time-to-live in milliseconds for each entry from write time. Must be >= 1.\r\n */\r\n constructor(maxSize: number = 1000, ttl: number = 5 * 60 * 1000) {\r\n if (!Number.isFinite(maxSize) || maxSize < 1) {\r\n throw new RangeError('maxSize must be a finite number greater than or equal to 1.');\r\n }\r\n if (!Number.isFinite(ttl) || ttl < 1) {\r\n throw new RangeError('ttl must be a finite number greater than or equal to 1.');\r\n }\r\n\r\n this.maxSize = maxSize;\r\n this.ttl = ttl;\r\n this.cleanupInterval = setInterval(() => this.cleanup(), 60 * 1000);\r\n if (this.cleanupInterval.unref) {\r\n this.cleanupInterval.unref();\r\n }\r\n }\r\n\r\n /**\r\n * Removes expired entries from the cache.\r\n */\r\n private cleanup() {\r\n const now = Date.now();\r\n for (const [key, item] of this.cache.entries()) {\r\n if (now >= item.expiry) {\r\n this.cache.delete(key);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Stores or updates a value in cache.\r\n * If the key already exists, the value and expiry are replaced.\r\n * If capacity is reached and key is new, least-recently-used entry is evicted.\r\n *\r\n * @param key Cache key.\r\n * @param value Value to store.\r\n */\r\n set(key: string, value: T) {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key);\r\n } else if (this.cache.size >= this.maxSize) {\r\n const firstKey = this.cache.keys().next().value;\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey);\r\n }\r\n }\r\n this.cache.set(key, { value, expiry: Date.now() + this.ttl });\r\n }\r\n\r\n /**\r\n * Reads a value by key.\r\n * Returns `undefined` if the key does not exist or if the entry has expired.\r\n * Access refreshes recency for eviction order (LRU behavior).\r\n *\r\n * @param key Cache key.\r\n * @returns Cached value or `undefined`.\r\n */\r\n get(key: string): T | undefined {\r\n const item = this.cache.get(key);\r\n if (!item) return undefined;\r\n if (Date.now() >= item.expiry) {\r\n this.cache.delete(key);\r\n return undefined;\r\n }\r\n this.cache.delete(key);\r\n Logger.logMessage('MemoryCache.get', `Successfully read cache data for key: ${key}`);\r\n this.cache.set(key, item);\r\n return item.value;\r\n }\r\n\r\n /**\r\n * Stops the background cleanup timer.\r\n * Call when the cache instance is no longer needed.\r\n */\r\n dispose() {\r\n clearInterval(this.cleanupInterval);\r\n }\r\n}\r\n\r\nexport default MemoryCache;\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Schema/definition.ts","../src/Schema/tieredPrice.ts","../src/Schema/index.ts","../src/MemoryCache/index.ts"],"names":["definition_default","ProductModel","ProductType","GenderCategory","OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","tieredPrice_default","PricingType","Schema","Schema_default","MemoryCache","maxSize","ttl","now","key","item","value","firstKey","Logger_default","MemoryCache_default"],"mappings":"sYAGA,IAAOA,CAAAA,CAAQ,CACb,GAAA,CAAO,WACP,CAAA,WAAA,CAAe,CACX,aAAiB,CAAA,CACb,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,2BACf,EACA,eAAmB,CAAA,CACf,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,gCACf,EACA,eAAmB,CAAA,CACf,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,gCACf,EACA,eAAmB,CAAA,CACf,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,gCACf,EACA,eAAmB,CAAA,CACf,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,gCACf,EACA,gBAAoB,CAAA,CAChB,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,iCACf,CACA,CAAA,IAAA,CAAQ,CACJ,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,uBACf,CAAA,CACA,OAAU,CACN,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,4BACf,CAAA,CACA,OAAU,CACN,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,4BACf,CAAA,CACA,OAAU,CACN,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,4BACf,CAAA,CACA,OAAU,CACN,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,4BACf,CAAA,CACA,QAAW,CACP,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,6BACf,CAAA,CACA,aAAgB,CACZ,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,uBACf,CAAA,CACA,eAAkB,CACd,IAAA,CAAQ,QACR,CAAA,OAAA,CAAW,4BACf,CAAA,CACA,cAAkB,CAAA,CACd,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,4BACf,CACA,CAAA,cAAA,CAAkB,CACd,IAAQ,CAAA,QAAA,CACR,OAAW,CAAA,4BACf,CACA,CAAA,cAAA,CAAkB,CAC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B,MACJ,CACA,OAAK,IAAA,CAAA,KAAA,CAAM,OAAOA,CAAG,CAAA,CACrBI,GAAO,CAAA,UAAA,CAAW,iBAAmB,CAAA,CAAA,sCAAA,EAAyCJ,CAAG,CAAE,CAAA,CAAA,CACnF,IAAK,CAAA,KAAA,CAAM,GAAIA,CAAAA,CAAAA,CAAKC,CAAI,CACjBA,CAAAA,CAAAA,CAAK,KAChB,CAAA,CAMA,OAAU,EAAA,CACN,aAAc,CAAA,IAAA,CAAK,eAAe,EACtC,CACJ,CAAA,CAEOI,CAAQT,CAAAA","file":"index.mjs","sourcesContent":["import { GenderCategory, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, ProductType } from \"../Classes/Enum\";\r\nimport ProductModel from \"../Classes/Product\";\r\n\r\nexport default {\r\n \"$id\": \"standards\",\r\n \"definitions\": {\r\n \"lowercaseText\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]*$\"\r\n },\r\n \"lowercaseText10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,10}$\"\r\n },\r\n \"lowercaseText16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,16}$\"\r\n },\r\n \"lowercaseText30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,30}$\"\r\n },\r\n \"lowercaseText50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,50}$\"\r\n },\r\n \"lowercaseText256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$)[a-z]{0,256}$\"\r\n },\r\n \"text\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).*$\"\r\n },\r\n \"text10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,10}$\"\r\n },\r\n \"text16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,16}$\"\r\n },\r\n \"text30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,30}$\"\r\n },\r\n \"text50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,50}$\"\r\n },\r\n \"text256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{0,256}$\"\r\n },\r\n \"requiredText\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).+$\"\r\n },\r\n \"requiredText10\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,10}$\"\r\n },\r\n \"requiredText16\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,16}$\"\r\n },\r\n \"requiredText30\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,30}$\"\r\n },\r\n \"requiredText50\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,50}$\"\r\n },\r\n \"requiredText256\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(?!\\\\s)(?!.*\\\\s$).{1,256}$\"\r\n },\r\n \"url\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^https://[^\\\\s/$.?#].[^\\\\s]*$\",\r\n \"maxLength\": 2048\r\n },\r\n \"uuid\": {\r\n \"type\": \"string\",\r\n \"minLength\": 1,\r\n \"pattern\": \"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\"\r\n },\r\n \"productKey\": {\r\n \"type\": \"string\",\r\n \"pattern\": ProductModel.productKeyRegex.source\r\n },\r\n \"productSku\": {\r\n \"type\": \"string\",\r\n \"pattern\": ProductModel.productSKURegex.source\r\n },\r\n \"productType\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(ProductType)\r\n },\r\n \"genderCategory\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(GenderCategory)\r\n },\r\n \"price\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"amount\": { \"type\": \"number\", \"minimum\": 0 },\r\n \"currency\": { \"$ref\": \"#/definitions/currency\" }\r\n },\r\n \"additionalProperties\": false,\r\n \"required\": [\"amount\", \"currency\"]\r\n },\r\n \"color\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"type\": \"string\"\r\n },\r\n \"hex\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"additionalProperties\": false,\r\n \"required\": [\r\n \"name\"\r\n ]\r\n },\r\n \"attributeValue\": {\r\n \"oneOf\": [\r\n { \"type\": \"string\" },\r\n {\r\n \"$ref\": \"#/definitions/color\"\r\n }\r\n ]\r\n },\r\n \"selectionAttributes\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"color\": { \"$ref\": \"#/definitions/color\" }\r\n },\r\n \"required\": [\"color\"],\r\n \"additionalProperties\": {\r\n \"$ref\": \"#/definitions/attributeValue\"\r\n }\r\n },\r\n \"firstName\": { \"$ref\": \"#/definitions/requiredText30\" },\r\n \"lastName\": { \"$ref\": \"#/definitions/text30\" },\r\n \"company\": { \"$ref\": \"#/definitions/text50\" },\r\n \"phone\": { \r\n \"type\" : \"string\",\r\n \"pattern\": \"^[0-9]{10}$\"\r\n },\r\n \"e164Phone\": {\r\n \"type\" : \"string\",\r\n \"pattern\": \"^\\\\+[1-9]\\\\d{1,14}$\"\r\n },\r\n \"email\": { \r\n \"type\" : \"string\",\r\n \"pattern\": \"^[^\\\\s]+@[^\\\\s]+\\\\.[^\\\\s]+$\"\r\n },\r\n \"addressLine1\": { \"$ref\": \"#/definitions/requiredText50\" },\r\n \"addressLine2\": { \"$ref\": \"#/definitions/text50\" },\r\n \"city\": { \"$ref\": \"#/definitions/requiredText30\" },\r\n \"postalCode\": { \"$ref\": \"#/definitions/requiredText16\" },\r\n \"state\": {\r\n \"type\": \"string\",\r\n \"enum\": [\"AP\", \"AR\", \"AS\", \"BR\", \"CT\", \"GA\", \"GJ\", \"HR\", \"HP\", \"JH\", \"KA\", \"KL\", \"MP\", \"MH\", \"MN\", \"ML\", \"MZ\", \"NL\", \"OR\", \"PB\", \"RJ\", \"SK\", \"TN\", \"TG\", \"TR\", \"UP\", \"UT\", \"WB\", \"AN\", \"CH\", \"DH\", \"LD\", \"DL\", \"PY\", \"LA\", \"JK\"]\r\n },\r\n \"country\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalCountry)\r\n },\r\n \"currency\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalCountryCurrency)\r\n },\r\n \"locale\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalLocale)\r\n },\r\n \"language\": {\r\n \"type\": \"string\",\r\n \"enum\": Object.values(OperationalLanguage)\r\n },\r\n \"localeOrLanguage\": {\r\n \"type\": \"string\",\r\n \"enum\": [...Object.values(OperationalLocale), ...Object.values(OperationalLanguage)]\r\n },\r\n \"addressType\": {\r\n \"type\": \"string\",\r\n \"enum\": [\"shipping\", \"billing\", \"billing&shipping\"]\r\n },\r\n \"address\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\"$ref\": \"standards#/definitions/firstName\"},\r\n \"lastName\": { \"$ref\": \"standards#/definitions/lastName\" },\r\n \"company\": { \"$ref\": \"standards#/definitions/company\" },\r\n \"phone\": { \"$ref\": \"standards#/definitions/phone\" },\r\n \"email\": { \"$ref\": \"standards#/definitions/email\" },\r\n \"addressLine1\": { \"$ref\": \"standards#/definitions/addressLine1\" },\r\n \"addressLine2\": { \"$ref\": \"standards#/definitions/addressLine2\" },\r\n \"city\": { \"$ref\": \"standards#/definitions/city\" },\r\n \"postalCode\": { \"$ref\": \"standards#/definitions/postalCode\" },\r\n \"state\": { \"$ref\": \"standards#/definitions/state\" },\r\n \"country\": { \"$ref\": \"standards#/definitions/country\" }\r\n },\r\n \"required\": [\"firstName\", \"lastName\", \"phone\", \"email\", \"addressLine1\", \"postalCode\", \"state\", \"country\"]\r\n }\r\n }\r\n}","import { PricingType } from \"../Classes/TieredPrice\";\n\nexport default {\n pricingType: {\n enum: Object.values(PricingType)\n },\n tier: {\n type: \"object\",\n properties: {\n enabled: { type: \"boolean\" },\n minQuantity: { type: \"integer\", minimum: 1 },\n unitPrice: { $ref: \"standards#/definitions/price\" }\n },\n required: [\"minQuantity\", \"unitPrice\"]\n },\n volumeTieredPrice: {\n type: \"object\",\n properties: {\n type: { const: PricingType.VOLUME },\n currency: { $ref: \"standards#/definitions/currencyCode\" },\n baseUnitPrice: { $ref: \"standards#/definitions/price\" },\n taxCategory: { $ref: \"standards#/definitions/requiredText\" },\n isTaxInclusive: { type: \"boolean\" },\n tiers: {\n type: \"array\",\n items: { $ref: \"#/definitions/tier\" }\n }\n },\n required: [\"taxCategory\", \"baseUnitPrice\"]\n },\n selectionTieredPrice: {\n type: \"object\",\n properties: {\n type: { const: PricingType.SELECTION },\n currency: { $ref: \"standards#/definitions/currencyCode\" },\n taxCategory: { $ref: \"standards#/definitions/requiredText\" },\n isTaxInclusive: { type: \"boolean\" },\n selections: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n selectionAttributes: { $ref: \"standards#/definitions/selectionAttributes\" },\n baseUnitPrice: { $ref: \"standards#/definitions/price\" },\n tiers: {\n type: \"array\",\n items: { $ref: \"#/definitions/tier\" }\n }\n },\n required: [\"selectionAttributes\", \"baseUnitPrice\"]\n }\n }\n },\n required: [\"type\", \"taxCategory\", \"currency\"]\n },\n tieredPrice: {\n anyOf: [\n { $ref: \"#/definitions/volumeTieredPrice\" },\n { \"$ref\": \"#/definitions/selectionTieredPrice\" }\n ]\n }\n};\n","import SchemaDefinitions from './definition';\r\nimport TieredPriceSchema from './tieredPrice';\r\n\r\nconst Schema = {\r\n getStandardSchemaDefinition() {\r\n return SchemaDefinitions;\r\n },\r\n TieredPriceSchema,\r\n}\r\n\r\nexport default Schema;\r\n","import Logger from \"../Logger\";\r\n\r\n/**\r\n * In-memory cache with per-entry TTL expiration and LRU-style eviction.\r\n *\r\n * Keys are `string` and values are generic (`T`).\r\n * Expired entries are removed lazily on `get` and periodically by a cleanup timer.\r\n */\r\nclass MemoryCache<T> {\r\n private cache: Map<string, { value: T; expiry: number }> = new Map();\r\n private maxSize: number;\r\n private ttl: number;\r\n private cleanupInterval: ReturnType<typeof setInterval>;\r\n\r\n /**\r\n * Creates a cache instance.\r\n *\r\n * @param maxSize Maximum number of live entries allowed in cache. Must be >= 1.\r\n * @param ttl Time-to-live in milliseconds for each entry from write time. Must be >= 1.\r\n */\r\n constructor(maxSize: number = 1000, ttl: number = 5 * 60 * 1000) {\r\n if (!Number.isFinite(maxSize) || maxSize < 1) {\r\n throw new RangeError('maxSize must be a finite number greater than or equal to 1.');\r\n }\r\n if (!Number.isFinite(ttl) || ttl < 1) {\r\n throw new RangeError('ttl must be a finite number greater than or equal to 1.');\r\n }\r\n\r\n this.maxSize = maxSize;\r\n this.ttl = ttl;\r\n this.cleanupInterval = setInterval(() => this.cleanup(), 60 * 1000);\r\n if (this.cleanupInterval.unref) {\r\n this.cleanupInterval.unref();\r\n }\r\n }\r\n\r\n /**\r\n * Removes expired entries from the cache.\r\n */\r\n private cleanup() {\r\n const now = Date.now();\r\n for (const [key, item] of this.cache.entries()) {\r\n if (now >= item.expiry) {\r\n this.cache.delete(key);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Stores or updates a value in cache.\r\n * If the key already exists, the value and expiry are replaced.\r\n * If capacity is reached and key is new, least-recently-used entry is evicted.\r\n *\r\n * @param key Cache key.\r\n * @param value Value to store.\r\n */\r\n set(key: string, value: T) {\r\n if (this.cache.has(key)) {\r\n this.cache.delete(key);\r\n } else if (this.cache.size >= this.maxSize) {\r\n const firstKey = this.cache.keys().next().value;\r\n if (firstKey !== undefined) {\r\n this.cache.delete(firstKey);\r\n }\r\n }\r\n this.cache.set(key, { value, expiry: Date.now() + this.ttl });\r\n }\r\n\r\n /**\r\n * Reads a value by key.\r\n * Returns `undefined` if the key does not exist or if the entry has expired.\r\n * Access refreshes recency for eviction order (LRU behavior).\r\n *\r\n * @param key Cache key.\r\n * @returns Cached value or `undefined`.\r\n */\r\n get(key: string): T | undefined {\r\n const item = this.cache.get(key);\r\n if (!item) return undefined;\r\n if (Date.now() >= item.expiry) {\r\n this.cache.delete(key);\r\n return undefined;\r\n }\r\n this.cache.delete(key);\r\n Logger.logMessage('MemoryCache.get', `Successfully read cache data for key: ${key}`);\r\n this.cache.set(key, item);\r\n return item.value;\r\n }\r\n\r\n /**\r\n * Stops the background cleanup timer.\r\n * Call when the cache instance is no longer needed.\r\n */\r\n dispose() {\r\n clearInterval(this.cleanupInterval);\r\n }\r\n}\r\n\r\nexport default MemoryCache;\r\n"]}
|