netlicensing-client 2.0.2 → 2.0.3

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.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var ut=Object.freeze({DISABLED:"DISABLED",PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),pe=ut;var pt=Object.freeze({FEATURE:"FEATURE",TIMEVOLUME:"TIMEVOLUME",FLOATING:"FLOATING",QUANTITY:"QUANTITY"}),z=pt;var ft=Object.freeze({LICENSEE_CREATED:"LICENSEE_CREATED",LICENSE_CREATED:"LICENSE_CREATED",WARNING_LEVEL_CHANGED:"WARNING_LEVEL_CHANGED",PAYMENT_TRANSACTION_PROCESSED:"PAYMENT_TRANSACTION_PROCESSED"}),G=ft;var lt=Object.freeze({WEBHOOK:"WEBHOOK"}),J=lt;var Tt=Object.freeze({BASIC_AUTHENTICATION:"BASIC_AUTH",APIKEY_IDENTIFICATION:"APIKEY",ANONYMOUS_IDENTIFICATION:"ANONYMOUS"}),N=Tt;var Pt=Object.freeze({DAY:"DAY",WEEK:"WEEK",MONTH:"MONTH",YEAR:"YEAR"}),fe=Pt;var gt=Object.freeze({DEFAULT:"DEFAULT",SHOP:"SHOP",APIKEY:"APIKEY",ACTION:"ACTION"}),W=gt;var Et=Object.freeze({SHOP:"SHOP",AUTO_LICENSE_CREATE:"AUTO_LICENSE_CREATE",AUTO_LICENSE_UPDATE:"AUTO_LICENSE_UPDATE",AUTO_LICENSE_DELETE:"AUTO_LICENSE_DELETE",AUTO_LICENSEE_CREATE:"AUTO_LICENSEE_CREATE",AUTO_LICENSEE_DELETE:"AUTO_LICENSEE_DELETE",AUTO_LICENSEE_VALIDATE:"AUTO_LICENSEE_VALIDATE",AUTO_LICENSETEMPLATE_DELETE:"AUTO_LICENSETEMPLATE_DELETE",AUTO_PRODUCTMODULE_DELETE:"AUTO_PRODUCTMODULE_DELETE",AUTO_PRODUCT_DELETE:"AUTO_PRODUCT_DELETE",AUTO_LICENSES_TRANSFER:"AUTO_LICENSES_TRANSFER",SUBSCRIPTION_UPDATE:"SUBSCRIPTION_UPDATE",RECURRING_PAYMENT:"RECURRING_PAYMENT",CANCEL_RECURRING_PAYMENT:"CANCEL_RECURRING_PAYMENT",OBTAIN_BUNDLE:"OBTAIN_BUNDLE"}),le=Et;var yt=Object.freeze({PENDING:"PENDING",CLOSED:"CLOSED",CANCELLED:"CANCELLED"}),Q=yt;var u={LicenseeSecretMode:pe,LicenseType:z,NotificationEvent:G,NotificationProtocol:J,SecurityMode:N,TimeVolumePeriod:fe,TokenType:W,TransactionSource:le,TransactionStatus:Q,BASIC_AUTHENTICATION:"BASIC_AUTH",APIKEY_IDENTIFICATION:"APIKEY",ANONYMOUS_IDENTIFICATION:"ANONYMOUS",FILTER:"filter",Product:{TYPE:"Product",ENDPOINT_PATH:"product"},ProductModule:{TYPE:"ProductModule",ENDPOINT_PATH:"productmodule",PRODUCT_MODULE_NUMBER:"productModuleNumber"},Licensee:{TYPE:"Licensee",ENDPOINT_PATH:"licensee",ENDPOINT_PATH_VALIDATE:"validate",ENDPOINT_PATH_TRANSFER:"transfer",LICENSEE_NUMBER:"licenseeNumber"},LicenseTemplate:{TYPE:"LicenseTemplate",ENDPOINT_PATH:"licensetemplate",LicenseType:z},License:{TYPE:"License",ENDPOINT_PATH:"license"},Validation:{TYPE:"ProductModuleValidation"},Token:{TYPE:"Token",ENDPOINT_PATH:"token",Type:W},PaymentMethod:{TYPE:"PaymentMethod",ENDPOINT_PATH:"paymentmethod"},Bundle:{TYPE:"Bundle",ENDPOINT_PATH:"bundle",ENDPOINT_OBTAIN_PATH:"obtain"},Notification:{TYPE:"Notification",ENDPOINT_PATH:"notification",Protocol:J,Event:G},Transaction:{TYPE:"Transaction",ENDPOINT_PATH:"transaction",Status:Q},Utility:{ENDPOINT_PATH:"utility",ENDPOINT_PATH_LICENSE_TYPES:"licenseTypes",ENDPOINT_PATH_LICENSING_MODELS:"licensingModels",ENDPOINT_PATH_COUNTRIES:"countries",LICENSING_MODEL_TYPE:"LicensingModelProperties",LICENSE_TYPE:"LicenseType",COUNTRY_TYPE:"Country"}};var Dt=Object.freeze({ROLE_APIKEY_LICENSEE:"ROLE_APIKEY_LICENSEE",ROLE_APIKEY_ANALYTICS:"ROLE_APIKEY_ANALYTICS",ROLE_APIKEY_OPERATION:"ROLE_APIKEY_OPERATION",ROLE_APIKEY_MAINTENANCE:"ROLE_APIKEY_MAINTENANCE",ROLE_APIKEY_ADMIN:"ROLE_APIKEY_ADMIN"}),vt=Dt;var ht=Object.freeze({TRY_AND_BUY:"TryAndBuy",SUBSCRIPTION:"Subscription",RENTAL:"Rental",FLOATING:"Floating",MULTI_FEATURE:"MultiFeature",PAY_PER_USE:"PayPerUse",PRICING_TABLE:"PricingTable",QUOTA:"Quota",NODE_LOCKED:"NodeLocked",DISCOUNT:"Discount"}),Nt=ht;var It=Object.freeze({PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),Lt=It;var bt=Object.freeze({NULL:"NULL",PAYPAL:"PAYPAL",PAYPAL_SANDBOX:"PAYPAL_SANDBOX",STRIPE:"STRIPE",STRIPE_TESTING:"STRIPE_TESTING"}),Rt=bt;var Ct=n=>{try{return JSON.parse(n)}catch{return n}},xt=n=>{let e={};return n?.forEach(({name:o,value:t})=>{e[o]=Ct(t)}),e},St=n=>{let e={};return n?.forEach(o=>{let{name:t}=o;e[t]=e[t]||[],e[t].push(Be(o))}),e},Be=n=>n?{...xt(n.property),...St(n.list)}:{},P=Be;var Te=(n,e)=>Object.hasOwn(n,e),c=(n,e,o)=>{n[e]=o},r=(n,e,o)=>Te(n,e)?n[e]:o;var D=(n,e={})=>{let o={},{ignore:t=[]}=e;return Object.entries(n).forEach(([i,s])=>{if(!t.includes(i)&&typeof s!="function")if(s===void 0)o[i]="";else if(typeof s=="string")o[i]=s;else if(s instanceof Date)o[i]=s.toISOString();else if(typeof s!="object"||s===null)o[i]=String(s);else try{o[i]=JSON.stringify(s)}catch{o[i]=String(s)}}),o};var At=function(n,e,o={},t){let i={set:[],get:[]};t?.get&&i.get.push(t.get),t?.set&&i.set.push(t.set);let s={set(a,d){c(n,a,d)},get(a,d){return r(n,a,d)},has(a){return Te(n,a)},setProperty(a,d){this.set(a,d)},addProperty(a,d){this.set(a,d)},getProperty(a,d){return this.get(a,d)},hasProperty(a){return this.has(a)},setProperties(a){Object.entries(a).forEach(([d,f])=>{this.set(d,f)})},serialize(){return D(n)}};return new Proxy(n,{get(a,d,f){return Object.hasOwn(e,d)?e[d]:Object.hasOwn(s,d)?s[d]:(i.get.forEach(l=>{l(a,d,f)}),Reflect.get(a,d,f))},set(a,d,f,l){return i.set.forEach(v=>{v(a,d,f,l)}),Reflect.set(a,d,f,l)},getPrototypeOf(){return o.prototype||null}})},g=At;var qe=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setLicenseTemplateNumbers(t){c(e,"licenseTemplateNumbers",t)},addLicenseTemplateNumber(t){e.licenseTemplateNumbers||(e.licenseTemplateNumbers=[]),e.licenseTemplateNumbers.push(t)},getLicenseTemplateNumbers(t){return r(e,"licenseTemplateNumbers",t)},removeLicenseTemplateNumber(t){let{licenseTemplateNumbers:i=[]}=e;i.splice(i.indexOf(t),1),e.licenseTemplateNumbers=i},getStaleLicenseTemplateNumbers(t){return r(e,"staleLicenseTemplateNumbers",t)},serialize(){let t={};return e.licenseTemplateNumbers&&(t.licenseTemplateNumbers=e.licenseTemplateNumbers.join(",")),D({...e,...t},{ignore:["staleLicenseTemplateNumbers"]})}},qe)},Pe=qe;var C=n=>{let e=P(n),{licenseTemplateNumbers:o}=e;return o&&typeof o=="string"&&(e.licenseTemplateNumbers=o.split(",")),Pe(e)};var Ye=function(n={}){let o={...{code:"",name:"",vatPercent:0,isEu:!1},...n};return g(o,{getCode(){return o.code},getName(){return o.name},getVatPercent(){return o.vatPercent},getIsEu(){return o.isEu}},Ye)},ge=Ye;var Ee=n=>ge(P(n));var Fe=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setHidden(t){c(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setLicenseeNumber(t){c(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setLicenseTemplateNumber(t){c(e,"licenseTemplateNumber",t)},getLicenseTemplateNumber(t){return r(e,"licenseTemplateNumber",t)},setProductModuleNumber(t){c(e,"productModuleNumber",t)},getProductModuleNumber(t){return r(e,"productModuleNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},Fe)},V=Fe;var b=n=>{let e=P(n),{startDate:o}=e;return o&&typeof o=="string"&&(e.startDate=o==="now"?o:new Date(o)),V(e)};var He=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setMarkedForTransfer(t){c(e,"markedForTransfer",t)},getMarkedForTransfer(t){return r(e,"markedForTransfer",t)},serialize(){return D(e,{ignore:["inUse"]})}},He)},ye=He;var x=n=>ye(P(n));var Ke=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setLicenseType(t){c(e,"licenseType",t)},getLicenseType(t){return r(e,"licenseType",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAutomatic(t){c(e,"automatic",t)},getAutomatic(t){return r(e,"automatic",t)},setHidden(t){c(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setHideLicenses(t){c(e,"hideLicenses",t)},getHideLicenses(t){return r(e,"hideLicenses",t)},setProductModuleNumber(t){c(e,"productModuleNumber",t)},getProductModuleNumber(t){return r(e,"productModuleNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},Ke)},De=Ke;var S=n=>De(P(n));var ze=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setProtocol(t){c(e,"protocol",t)},getProtocol(t){return r(e,"protocol",t)},setEvents(t){c(e,"events",t)},getEvents(t){return r(e,"events",t)},addEvent(t){let i=this.getEvents([]);i.push(t),this.setEvents(i)},setPayload(t){c(e,"payload",t)},getPayload(t){return r(e,"payload",t)},setEndpoint(t){c(e,"endpoint",t)},getEndpoint(t){return r(e,"endpoint",t)},serialize(){let t=D(e);return t.events&&(t.events=this.getEvents([]).join(",")),t}},ze)},ve=ze;var A=n=>{let e=P(n),{events:o}=e;return o&&typeof o=="string"&&(e.events=o.split(",")),ve(e)};var Ge=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)}},Ge)},he=Ge;var $=n=>he(P(n));var Je=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setVersion(t){c(e,"version",t)},getVersion(t){return r(e,"version",t)},setDescription(t){c(e,"description",t)},getDescription(t){return r(e,"description",t)},setLicensingInfo(t){c(e,"licensingInfo",t)},getLicensingInfo(t){return r(e,"licensingInfo",t)},setLicenseeAutoCreate(t){c(e,"licenseeAutoCreate",t)},getLicenseeAutoCreate(t){return r(e,"licenseeAutoCreate",t)},setDiscounts(t){c(e,"discounts",t)},getDiscounts(t){return r(e,"discounts",t)},addDiscount(t){let i=this.getDiscounts([]);i.push(t),this.setDiscounts(i)},removeDiscount(t){let i=this.getDiscounts();Array.isArray(i)&&i.length>0&&(i.splice(i.indexOf(t),1),this.setDiscounts(i))},setProductDiscounts(t){this.setDiscounts(t)},getProductDiscounts(t){return this.getDiscounts(t)},serialize(){let t=D(e,{ignore:["discounts","inUse"]}),i=this.getDiscounts();return i&&(t.discount=i.length>0?i.map(s=>s.toString()):""),t}},Je)},Ne=Je;import{AxiosError as Mt}from"axios";var h=class n extends Mt{constructor(o,t,i,s,a,d){super(o,t,i,s,a);this.isNlicError=!0;this.name="NlicError",d&&(this.stack=d),Object.setPrototypeOf(this,n.prototype)}};var We=function(n={}){let e={...n};if(e.amountFix&&e.amountPercent)throw new h('Properties "amountFix" and "amountPercent" cannot be used at the same time');return g(e,{setTotalPrice(t){c(e,"totalPrice",t)},getTotalPrice(t){return r(e,"totalPrice",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAmountFix(t){c(e,"amountFix",t)},getAmountFix(t){return r(e,"amountFix",t)},setAmountPercent(t){c(e,"amountPercent",t)},getAmountPercent(t){return r(e,"amountPercent",t)},toString(){let t=this.getTotalPrice(),i=this.getCurrency(),s=this.getAmountPercent()?`${this.getAmountPercent()}%`:this.getAmountFix();return t&&i&&s?`${t};${i};${s}`:""}},We,{set:(t,i)=>{i==="amountFix"&&delete t.amountPercent,i==="amountPercent"&&delete t.amountFix}})},Ie=We;var M=n=>{let e=P(n),o=e.discount;return delete e.discount,o&&(e.discounts=o.map(t=>Ie(t))),Ne(e)};var Qe=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setLicensingModel(t){c(e,"licensingModel",t)},getLicensingModel(t){return r(e,"licensingModel",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},Qe)},Le=Qe;var O=n=>Le(P(n));var Xe=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setExpirationTime(t){c(e,"expirationTime",t)},getExpirationTime(t){return r(e,"expirationTime",t)},setTokenType(t){c(e,"tokenType",t)},getTokenType(t){return r(e,"tokenType",t)},setLicenseeNumber(t){c(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setAction(t){c(e,"action",t)},getAction(t){return r(e,"action",t)},setApiKeyRole(t){c(e,"apiKeyRole",t)},getApiKeyRole(t){return r(e,"apiKeyRole",t)},setBundleNumber(t){c(e,"bundleNumber",t)},getBundleNumber(t){return r(e,"bundleNumber",t)},setBundlePrice(t){c(e,"bundlePrice",t)},getBundlePrice(t){return r(e,"bundlePrice",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setPredefinedShoppingItem(t){c(e,"predefinedShoppingItem",t)},getPredefinedShoppingItem(t){return r(e,"predefinedShoppingItem",t)},setSuccessURL(t){c(e,"successURL",t)},getSuccessURL(t){return r(e,"successURL",t)},setSuccessURLTitle(t){c(e,"successURLTitle",t)},getSuccessURLTitle(t){return r(e,"successURLTitle",t)},setCancelURL(t){c(e,"cancelURL",t)},getCancelURL(t){return r(e,"cancelURL",t)},setCancelURLTitle(t){c(e,"cancelURLTitle",t)},getCancelURLTitle(t){return r(e,"cancelURLTitle",t)},getShopURL(t){return r(e,"shopURL",t)},serialize(){return D(e,{ignore:["shopURL"]})}},Xe)},be=Xe;var B=n=>{let e=P(n),{expirationTime:o}=e;return o&&typeof o=="string"&&(e.expirationTime=new Date(o)),be(e)};var Re=class{constructor(e,o){this.transaction=e,this.license=o}setTransaction(e){this.transaction=e}getTransaction(){return this.transaction}setLicense(e){this.license=e}getLicense(){return this.license}},Ce=(n,e)=>new Re(n,e);var Ze=function(n={}){let e={...n};return g(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setStatus(t){c(e,"status",t)},getStatus(t){return r(e,"status",t)},setSource(t){c(e,"source",t)},getSource(t){return r(e,"source",t)},setGrandTotal(t){c(e,"grandTotal",t)},getGrandTotal(t){return r(e,"grandTotal",t)},setDiscount(t){c(e,"discount",t)},getDiscount(t){return r(e,"discount",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setDateCreated(t){c(e,"dateCreated",t)},getDateCreated(t){return r(e,"dateCreated",t)},setDateClosed(t){c(e,"dateClosed",t)},getDateClosed(t){return r(e,"dateClosed",t)},setPaymentMethod(t){c(e,"paymentMethod",t)},getPaymentMethod(t){return r(e,"paymentMethod",t)},setLicenseTransactionJoins(t){c(e,"licenseTransactionJoins",t)},getLicenseTransactionJoins(t){return r(e,"licenseTransactionJoins",t)},serialize(){let t={...e};return t.datecreated=e.dateCreated,t.dateclosed=e.dateClosed,delete t.dateCreated,delete t.dateClosed,D(t,{ignore:["licenseTransactionJoins","inUse"]})}},Ze)},X=Ze;var _=n=>{let e=P(n),{datecreated:o,dateclosed:t}=e;o&&typeof o=="string"&&(e.dateCreated=new Date(o),delete e.datecreated),t&&typeof t=="string"&&(e.dateClosed=new Date(t),delete e.dateclosed);let i=e.licenseTransactionJoin;return delete e.licenseTransactionJoin,i&&(e.licenseTransactionJoins=i.map(({transactionNumber:s,licenseNumber:a})=>{let d=X({number:s}),f=V({number:a});return Ce(d,f)})),X(e)};import Ot from"axios";var et=Ot.create(),tt=null,nt=[],ot=n=>{et=n},Z=()=>et,xe=n=>{tt=n},it=()=>tt,Se=n=>{nt=n},st=()=>nt;var Ae={name:"netlicensing-client",version:"2.0.1",description:"JavaScript Wrapper for Labs64 NetLicensing RESTful API",keywords:["labs64","netlicensing","licensing","licensing-as-a-service","license","license-management","software-license","client","restful","restful-api","javascript","wrapper","api","client"],license:"Apache-2.0",author:"Labs64 GmbH",homepage:"https://netlicensing.io",repository:{type:"git",url:"git+https://github.com/Labs64/NetLicensingClient-javascript.git"},bugs:{url:"https://github.com/Labs64/NetLicensingClient-javascript/issues"},contributors:[{name:"Ready Brown",email:"ready.brown@hotmail.de",url:"https://github.com/r-brown"},{name:"Viacheslav Rudkovskiy",email:"viachaslau.rudkovski@labs64.de",url:"https://github.com/v-rudkovskiy"},{name:"Andrei Yushkevich",email:"yushkevich@me.com",url:"https://github.com/yushkevich"}],main:"dist/index.cjs",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"}},files:["dist"],scripts:{build:"tsup",release:"npm run lint:typecheck && npm run test && npm run build",dev:"tsup --watch",test:"vitest run","test:dev":"vitest watch",lint:"eslint --ext .js,.mjs,.ts src",typecheck:"tsc --noEmit","lint:typecheck":"npm run lint && npm run typecheck"},peerDependencies:{axios:"^1.9.0"},dependencies:{},devDependencies:{"@eslint/js":"^9.39.4","@types/node":"^25.3.5","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.29.1","@vitest/eslint-plugin":"^1.1.43",axios:"^1.13.6",eslint:"^9.39.4","eslint-plugin-import":"^2.31.0",prettier:"3.8.1",tsup:"^8.4.0",typescript:"^5.8.3","typescript-eslint":"^8.29.1",vitest:"^3.2.4"},engines:{node:">= 16.9.0",npm:">= 8.0.0"},browserslist:["> 1%","last 2 versions","not ie <= 10"]};var ee=n=>{let e=[],o=(t,i)=>{if(t!=null){if(Array.isArray(t)){t.forEach(s=>{o(s,i?`${i}`:"")});return}if(t instanceof Date){e.push(`${i}=${encodeURIComponent(t.toISOString())}`);return}if(typeof t=="object"){Object.keys(t).forEach(s=>{let a=t[s];o(a,i?`${i}[${encodeURIComponent(s)}]`:encodeURIComponent(s))});return}e.push(`${i}=${encodeURIComponent(t)}`)}};return o(n),e.join("&")};var w=async(n,e,o,t,i)=>{let s={Accept:"application/json","X-Requested-With":"XMLHttpRequest"};typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(s["User-agent"]=`NetLicensing/Javascript ${Ae.version}/node&${process.version}`);let a={method:e,headers:s,url:encodeURI(`${n.getBaseUrl()}/${o}`),responseType:"json",transformRequest:(f,l)=>l["Content-Type"]==="application/x-www-form-urlencoded"?ee(f):(l["NetLicensing-Origin"]||(l["NetLicensing-Origin"]=`NetLicensing/Javascript ${Ae.version}`),f)};switch(["put","post","patch"].indexOf(e.toLowerCase())>=0?(a.method==="post"&&(s["Content-Type"]="application/x-www-form-urlencoded"),a.data=t):a.params=t,n.getSecurityMode()){case N.BASIC_AUTHENTICATION:{if(!n.getUsername())throw new h('Missing parameter "username"');if(!n.getPassword())throw new h('Missing parameter "password"');a.auth={username:n.getUsername(),password:n.getPassword()}}break;case N.APIKEY_IDENTIFICATION:if(!n.getApiKey())throw new h('Missing parameter "apiKey"');s.Authorization=`Basic ${btoa(`apiKey:${n.getApiKey()}`)}`;break;case N.ANONYMOUS_IDENTIFICATION:break;default:throw new h("Unknown security mode")}let d=i?.axiosInstance||Z();try{let f=await d(a),l=f.data.infos?.info||[];if(xe(f),Se(l),i?.onResponse&&i.onResponse(f),l.length>0){i?.onInfo&&i.onInfo(l);let v=l.find(({type:I})=>I==="ERROR");if(v)throw new h(v.value,v.id,f.config,f.request,f)}return f}catch(f){let l=f,v=l.response,I=v?.data?.infos?.info||[];if(xe(v||null),Se(I),f.isAxiosError){let L=f.message;if(v?.data&&I.length>0){let j=I.find(({type:k})=>k==="ERROR");j&&(L=j.value)}throw new h(L,l.code,l.config,l.request,l.response)}throw f}};var rt=(n,e,o,t)=>w(n,"get",e,o,t),at=(n,e,o,t)=>w(n,"post",e,o,t),ct=(n,e,o,t)=>w(n,"delete",e,o,t);var wt={setAxiosInstance(n){ot(n)},getAxiosInstance(){return Z()},getLastHttpRequestInfo(){return it()},getInfo(){return st()},get(n,e,o,t){return rt(n,e,o,t)},post(n,e,o,t){return at(n,e,o,t)},delete(n,e,o,t){return ct(n,e,o,t)},request(n,e,o,t,i){return w(n,e,o,t,i)},toQueryString(n){return ee(n)}},m=wt;var y=n=>Object.keys(n).map(e=>`${e}=${String(n[e])}`).join(";"),Ut=n=>{let e={};return n.split(";").forEach(o=>{let[t,i]=o.split("=");e[t]=i}),e};var dt=n=>typeof n<"u"&&typeof n!="function",te=n=>dt(n)?typeof n=="number"?!Number.isNaN(n):!0:!1,T=(n,e)=>{if(n===null)throw new TypeError(`Parameter "${e}" cannot be null.`);if(!te(n))throw new TypeError(`Parameter "${e}" has an invalid value.`)},p=(n,e)=>{if(T(n,e),!n)throw new TypeError(`Parameter "${e}" cannot be empty.`)};var mt=function(n,e){let o=parseInt(e?.pagenumber||"0",10),t=parseInt(e?.itemsnumber||"0",10),i=parseInt(e?.totalpages||"0",10),s=parseInt(e?.totalitems||"0",10),a={getContent(){return n},getPagination(){return{pageNumber:o,itemsNumber:t,totalPages:i,totalItems:s,hasNext:i>o+1}},getPageNumber(){return o},getItemsNumber(){return t},getTotalPages(){return i},getTotalItems(){return s},hasNext(){return i>o+1}};return new Proxy(n,{get(d,f,l){return Object.hasOwn(a,f)?a[f]:Reflect.get(d,f,l)},set(d,f,l,v){return Reflect.set(d,f,l,v)},getPrototypeOf(){return mt.prototype||null}})},E=mt;var U=u.Bundle.ENDPOINT_PATH,jt=u.Bundle.ENDPOINT_OBTAIN_PATH,ne=u.Bundle.TYPE,kt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${U}/${e}`,{},o)).data.items?.item.find(s=>s.type===ne);return C(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,U,t,o)).data.items,a=s?.item.filter(d=>d.type===ne).map(d=>C(d));return E(a||[],s)},async create(n,e,o){T(e,"bundle");let i=(await m.post(n,U,e.serialize(),o)).data.items?.item.find(s=>s.type===ne);return C(i)},async update(n,e,o,t){p(e,"number"),T(o,"bundle");let s=(await m.post(n,`${U}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ne);return C(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${U}/${e}`,{forceCascade:!!o},t)},async obtain(n,e,o,t){p(e,"number"),p(o,"licenseeNumber");let i={[u.Licensee.LICENSEE_NUMBER]:o};return(await m.post(n,`${U}/${e}/${jt}`,i,t)).data.items?.item.filter(f=>f.type===u.License.TYPE)?.map(f=>b(f))||[]}},Vt=kt;var Me=class{constructor(){this.validations={}}getValidators(){return this.validations}setValidation(e){return this.validations[e.productModuleNumber]=e,this}getValidation(e,o){return this.validations[e]||o}setProductModuleValidation(e){return this.setValidation(e)}getProductModuleValidation(e,o){return this.getValidation(e,o)}setTtl(e){if(!te(e))throw new TypeError(`Bad ttl:${e.toString()}`);return this.ttl=new Date(e),this}getTtl(){return this.ttl}toString(){let e="ValidationResult [";return Object.keys(this.validations).forEach(o=>{e+=`ProductModule<${o}>`,o in this.validations&&(e+=JSON.stringify(this.validations[o]))}),e+="]",e}},Oe=()=>new Me;var R=u.Licensee.ENDPOINT_PATH,$t=u.Licensee.ENDPOINT_PATH_VALIDATE,Bt=u.Licensee.ENDPOINT_PATH_TRANSFER,oe=u.Licensee.TYPE,qt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${R}/${e}`,{},o)).data.items?.item.find(s=>s.type===oe);return x(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,R,t,o)).data.items,a=s?.item.filter(d=>d.type===oe).map(d=>x(d));return E(a||[],s)},async create(n,e,o,t){T(o,"licensee");let i=o.serialize();e&&(i.productNumber=e);let a=(await m.post(n,R,i,t)).data.items?.item.find(d=>d.type===oe);return x(a)},async update(n,e,o,t){p(e,"number"),T(o,"licensee");let s=(await m.post(n,`${R}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===oe);return x(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${R}/${e}`,{forceCascade:!!o},t)},async validate(n,e,o,t){p(e,"number");let i={};if(o){let l=o.productNumber;l&&(i.productNumber=l);let v=o.licenseeProperties;Object.keys(v).forEach(L=>{i[L]=o.getLicenseeProperty(L)}),o.isForOfflineUse()&&(i.forOfflineUse=!0),o.isDryRun()&&(i.dryRun=!0);let I=o.getParameters();Object.keys(I).forEach((L,j)=>{i[`${u.ProductModule.PRODUCT_MODULE_NUMBER}${j}`]=L;let k=I[L];k&&Object.keys(k).forEach($e=>{i[$e+j]=k[$e]})})}let s=await m.post(n,`${R}/${e}/${$t}`,i,t),a=Oe(),d=s.data.ttl;return d&&a.setTtl(d),s.data.items?.item.filter(l=>l.type===u.Validation.TYPE)?.forEach(l=>{a.setValidation(P(l))}),a},transfer(n,e,o,t){p(e,"number"),p(o,"sourceLicenseeNumber");let i={sourceLicenseeNumber:o};return m.post(n,`${R}/${e}/${Bt}`,i,t)}},Yt=qt;var q=u.License.ENDPOINT_PATH,ie=u.License.TYPE,Ft={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${q}/${e}`,{},o)).data.items?.item.find(s=>s.type===ie);return b(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,q,t,o)).data.items,a=s?.item.filter(d=>d.type===ie).map(d=>b(d));return E(a||[],s)},async create(n,e,o,t,i,s){T(i,"license");let a=i.serialize();e&&(a.licenseeNumber=e),o&&(a.licenseTemplateNumber=o),t&&(a.transactionNumber=t);let f=(await m.post(n,q,a,s)).data.items?.item.find(l=>l.type===ie);return b(f)},async update(n,e,o,t,i){p(e,"number"),T(t,"license");let s=t.serialize();o&&(s.transactionNumber=o);let d=(await m.post(n,`${q}/${e}`,s,i)).data.items?.item.find(f=>f.type===ie);return b(d)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${q}/${e}`,{forceCascade:!!o},t)}},Ht=Ft;var Y=u.LicenseTemplate.ENDPOINT_PATH,se=u.LicenseTemplate.TYPE,Kt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${Y}/${e}`,{},o)).data.items?.item.find(s=>s.type===se);return S(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,Y,t,o)).data.items,a=s?.item.filter(d=>d.type===se).map(d=>S(d));return E(a||[],s)},async create(n,e,o,t){T(o,"licenseTemplate");let i=o.serialize();e&&(i.productModuleNumber=e);let a=(await m.post(n,Y,i,t)).data.items?.item.find(d=>d.type===se);return S(a)},async update(n,e,o,t){p(e,"number"),T(o,"licenseTemplate");let s=(await m.post(n,`${Y}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===se);return S(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${Y}/${e}`,{forceCascade:!!o},t)}},zt=Kt;var F=u.Notification.ENDPOINT_PATH,re=u.Notification.TYPE,Gt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${F}/${e}`,{},o)).data.items?.item.find(s=>s.type===re);return A(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,F,t,o)).data.items,a=s?.item.filter(d=>d.type===re).map(d=>A(d));return E(a||[],s)},async create(n,e,o){T(e,"notification");let i=(await m.post(n,F,e.serialize(),o)).data.items?.item.find(s=>s.type===re);return A(i)},async update(n,e,o,t){p(e,"number"),T(o,"notification");let s=(await m.post(n,`${F}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===re);return A(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${F}/${e}`,{forceCascade:!!o},t)}},Jt=Gt;var _e=u.PaymentMethod.ENDPOINT_PATH,we=u.PaymentMethod.TYPE,Wt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${_e}/${e}`,{},o)).data.items?.item.find(s=>s.type===we);return $(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,_e,t,o)).data.items,a=s?.item.filter(d=>d.type===we).map(d=>$(d));return E(a||[],s)},async update(n,e,o,t){p(e,"number"),T(o,"paymentMethod");let s=(await m.post(n,`${_e}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===we);return $(s)}},Qt=Wt;var H=u.ProductModule.ENDPOINT_PATH,ae=u.ProductModule.TYPE,Xt={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${H}/${e}`,{},o)).data.items?.item.find(s=>s.type===ae);return O(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,H,t,o)).data.items,a=s?.item.filter(d=>d.type===ae).map(d=>O(d));return E(a||[],s)},async create(n,e,o,t){T(o,"productModule");let i=o.serialize();e&&(i.productNumber=e);let a=(await m.post(n,H,i,t)).data.items?.item.find(d=>d.type===ae);return O(a)},async update(n,e,o,t){p(e,"number"),T(o,"productModule");let s=(await m.post(n,`${H}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ae);return O(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${H}/${e}`,{forceCascade:!!o},t)}},Zt=Xt;var K=u.Product.ENDPOINT_PATH,ce=u.Product.TYPE,en={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${K}/${e}`,{},o)).data.items?.item.find(s=>s.type===ce);return M(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,K,t,o)).data.items,a=s?.item.filter(d=>d.type===ce).map(d=>M(d));return E(a||[],s)},async create(n,e,o){T(e,"product");let i=(await m.post(n,K,e.serialize(),o)).data.items?.item.find(s=>s.type===ce);return M(i)},async update(n,e,o,t){p(e,"number"),T(o,"product");let s=(await m.post(n,`${K}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ce);return M(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${K}/${e}`,{forceCascade:!!o},t)}},tn=en;var de=u.Token.ENDPOINT_PATH,Ue=u.Token.TYPE,nn={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${de}/${e}`,{},o)).data.items?.item.find(s=>s.type===Ue);return B(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,de,t,o)).data.items,a=s?.item.filter(d=>d.type===Ue).map(d=>B(d));return E(a||[],s)},async create(n,e,o){T(e,"token");let i=(await m.post(n,de,e.serialize(),o)).data.items?.item.find(s=>s.type===Ue);return B(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${de}/${e}`,{forceCascade:!!o},t)}},on=nn;var me=u.Transaction.ENDPOINT_PATH,ue=u.Transaction.TYPE,sn={async get(n,e,o){p(e,"number");let i=(await m.get(n,`${me}/${e}`,{},o)).data.items?.item.find(s=>s.type===ue);return _(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let s=(await m.get(n,me,t,o)).data.items,a=s?.item.filter(d=>d.type===ue).map(d=>_(d));return E(a||[],s)},async create(n,e,o){T(e,"transaction");let i=(await m.post(n,me,e.serialize(),o)).data.items?.item.find(s=>s.type===ue);return _(i)},async update(n,e,o,t){p(e,"number"),T(o,"transaction");let s=(await m.post(n,`${me}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ue);return _(s)}},rn=sn;var je=u.Utility.ENDPOINT_PATH,an={async listLicenseTypes(n,e){let o=`${je}/${u.Utility.ENDPOINT_PATH_LICENSE_TYPES}`,i=(await m.get(n,o,void 0,e)).data.items,s=u.Utility.LICENSE_TYPE,a=i?.item.filter(d=>d.type===s).map(d=>P(d).name);return E(a||[],i)},async listLicensingModels(n,e){let o=`${je}/${u.Utility.ENDPOINT_PATH_LICENSING_MODELS}`,i=(await m.get(n,o,void 0,e)).data.items,s=u.Utility.LICENSING_MODEL_TYPE,a=i?.item.filter(d=>d.type===s).map(d=>P(d).name);return E(a||[],i)},async listCountries(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:y(e));let i=`${je}/${u.Utility.ENDPOINT_PATH_COUNTRIES}`,a=(await m.get(n,i,t,o)).data.items,d=u.Utility.COUNTRY_TYPE,f=a?.item.filter(l=>l.type===d).map(l=>Ee(l));return E(f||[],a)}},cn=an;var ke=class{constructor(e){this.baseUrl=e?.baseUrl||"https://go.netlicensing.io/core/v2/rest",this.securityMode=e?.securityMode||N.BASIC_AUTHENTICATION,this.username=e?.username,this.password=e?.password,this.apiKey=e?.apiKey,this.publicKey=e?.publicKey}setBaseUrl(e){return this.baseUrl=e,this}getBaseUrl(){return this.baseUrl}setSecurityMode(e){return this.securityMode=e,this}getSecurityMode(){return this.securityMode}setUsername(e){return this.username=e,this}getUsername(e){return this.username||e}setPassword(e){return this.password=e,this}getPassword(e){return this.password||e}setApiKey(e){return this.apiKey=e,this}getApiKey(e){return this.apiKey||e}setPublicKey(e){return this.publicKey=e,this}getPublicKey(e){return this.publicKey||e}},dn=n=>new ke(n);var Ve=class{constructor(){this.parameters={},this.licenseeProperties={}}setProductNumber(e){return this.productNumber=e,this}getProductNumber(){return this.productNumber}setLicenseeName(e){return this.licenseeProperties.licenseeName=e,this}getLicenseeName(){return this.licenseeProperties.licenseeName}setLicenseeSecret(e){return this.licenseeProperties.licenseeSecret=e,this}getLicenseeSecret(){return this.licenseeProperties.licenseeSecret}getLicenseeProperties(){return this.licenseeProperties}setLicenseeProperty(e,o){return this.licenseeProperties[e]=o,this}getLicenseeProperty(e,o){return this.licenseeProperties[e]||o}setForOfflineUse(e){return this.forOfflineUse=e,this}isForOfflineUse(){return!!this.forOfflineUse}setDryRun(e){return this.dryRun=e,this}isDryRun(){return!!this.dryRun}getParameters(){return this.parameters}setParameter(e,o){return this.parameters[e]=o,this}getParameter(e){return this.parameters[e]}getProductModuleValidationParameters(e){return this.getParameter(e)}setProductModuleValidationParameters(e,o){return this.setParameter(e,o)}},mn=()=>new Ve;export{vt as ApiKeyRole,Pe as Bundle,Vt as BundleService,u as Constants,dn as Context,ge as Country,V as License,Ht as LicenseService,De as LicenseTemplate,zt as LicenseTemplateService,Ce as LicenseTransactionJoin,z as LicenseType,ye as Licensee,pe as LicenseeSecretMode,Yt as LicenseeService,Nt as LicensingModel,h as NlicError,Lt as NodeSecretMode,ve as Notification,G as NotificationEvent,J as NotificationProtocol,Jt as NotificationService,E as Page,he as PaymentMethod,Rt as PaymentMethodEnum,Qt as PaymentMethodService,Ne as Product,Ie as ProductDiscount,Le as ProductModule,Zt as ProductModuleService,tn as ProductService,N as SecurityMode,m as Service,fe as TimeVolumePeriod,be as Token,on as TokenService,W as TokenType,X as Transaction,rn as TransactionService,le as TransactionSource,Q as TransactionStatus,cn as UtilityService,mn as ValidationParameters,Oe as ValidationResults,g as defineEntity,p as ensureNotEmpty,T as ensureNotNull,Ut as filterDecode,y as filterEncode,dt as isDefined,te as isValid,C as itemToBundle,Ee as itemToCountry,b as itemToLicense,S as itemToLicenseTemplate,x as itemToLicensee,A as itemToNotification,P as itemToObject,$ as itemToPaymentMethod,M as itemToProduct,O as itemToProductModule,B as itemToToken,_ as itemToTransaction,D as serialize};
1
+ var ft=Object.freeze({DISABLED:"DISABLED",PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),pe=ft;var gt=Object.freeze({FEATURE:"FEATURE",TIMEVOLUME:"TIMEVOLUME",FLOATING:"FLOATING",QUANTITY:"QUANTITY"}),z=gt;var Tt=Object.freeze({LICENSEE_CREATED:"LICENSEE_CREATED",LICENSE_CREATED:"LICENSE_CREATED",WARNING_LEVEL_CHANGED:"WARNING_LEVEL_CHANGED",PAYMENT_TRANSACTION_PROCESSED:"PAYMENT_TRANSACTION_PROCESSED"}),J=Tt;var Pt=Object.freeze({WEBHOOK:"WEBHOOK"}),G=Pt;var yt=Object.freeze({BASIC_AUTHENTICATION:"BASIC_AUTH",APIKEY_IDENTIFICATION:"APIKEY",ANONYMOUS_IDENTIFICATION:"ANONYMOUS"}),N=yt;var Et=Object.freeze({DAY:"DAY",WEEK:"WEEK",MONTH:"MONTH",YEAR:"YEAR"}),le=Et;var Dt=Object.freeze({DEFAULT:"DEFAULT",SHOP:"SHOP",APIKEY:"APIKEY",ACTION:"ACTION"}),W=Dt;var vt=Object.freeze({SHOP:"SHOP",AUTO_LICENSE_CREATE:"AUTO_LICENSE_CREATE",AUTO_LICENSE_UPDATE:"AUTO_LICENSE_UPDATE",AUTO_LICENSE_DELETE:"AUTO_LICENSE_DELETE",AUTO_LICENSEE_CREATE:"AUTO_LICENSEE_CREATE",AUTO_LICENSEE_DELETE:"AUTO_LICENSEE_DELETE",AUTO_LICENSEE_VALIDATE:"AUTO_LICENSEE_VALIDATE",AUTO_LICENSETEMPLATE_DELETE:"AUTO_LICENSETEMPLATE_DELETE",AUTO_PRODUCTMODULE_DELETE:"AUTO_PRODUCTMODULE_DELETE",AUTO_PRODUCT_DELETE:"AUTO_PRODUCT_DELETE",AUTO_LICENSES_TRANSFER:"AUTO_LICENSES_TRANSFER",SUBSCRIPTION_UPDATE:"SUBSCRIPTION_UPDATE",RECURRING_PAYMENT:"RECURRING_PAYMENT",CANCEL_RECURRING_PAYMENT:"CANCEL_RECURRING_PAYMENT",OBTAIN_BUNDLE:"OBTAIN_BUNDLE"}),fe=vt;var ht=Object.freeze({PENDING:"PENDING",CLOSED:"CLOSED",CANCELLED:"CANCELLED"}),Q=ht;var u={LicenseeSecretMode:pe,LicenseType:z,NotificationEvent:J,NotificationProtocol:G,SecurityMode:N,TimeVolumePeriod:le,TokenType:W,TransactionSource:fe,TransactionStatus:Q,BASIC_AUTHENTICATION:"BASIC_AUTH",APIKEY_IDENTIFICATION:"APIKEY",ANONYMOUS_IDENTIFICATION:"ANONYMOUS",FILTER:"filter",Product:{TYPE:"Product",ENDPOINT_PATH:"product"},ProductModule:{TYPE:"ProductModule",ENDPOINT_PATH:"productmodule",PRODUCT_MODULE_NUMBER:"productModuleNumber"},Licensee:{TYPE:"Licensee",ENDPOINT_PATH:"licensee",ENDPOINT_PATH_VALIDATE:"validate",ENDPOINT_PATH_TRANSFER:"transfer",LICENSEE_NUMBER:"licenseeNumber"},LicenseTemplate:{TYPE:"LicenseTemplate",ENDPOINT_PATH:"licensetemplate",LicenseType:z},License:{TYPE:"License",ENDPOINT_PATH:"license"},Validation:{TYPE:"ProductModuleValidation"},Token:{TYPE:"Token",ENDPOINT_PATH:"token",Type:W},PaymentMethod:{TYPE:"PaymentMethod",ENDPOINT_PATH:"paymentmethod"},Bundle:{TYPE:"Bundle",ENDPOINT_PATH:"bundle",ENDPOINT_OBTAIN_PATH:"obtain"},Notification:{TYPE:"Notification",ENDPOINT_PATH:"notification",Protocol:G,Event:J},Transaction:{TYPE:"Transaction",ENDPOINT_PATH:"transaction",Status:Q},Utility:{ENDPOINT_PATH:"utility",ENDPOINT_PATH_LICENSE_TYPES:"licenseTypes",ENDPOINT_PATH_LICENSING_MODELS:"licensingModels",ENDPOINT_PATH_COUNTRIES:"countries",LICENSING_MODEL_TYPE:"LicensingModelProperties",LICENSE_TYPE:"LicenseType",COUNTRY_TYPE:"Country"}};var Nt=Object.freeze({ROLE_APIKEY_LICENSEE:"ROLE_APIKEY_LICENSEE",ROLE_APIKEY_ANALYTICS:"ROLE_APIKEY_ANALYTICS",ROLE_APIKEY_OPERATION:"ROLE_APIKEY_OPERATION",ROLE_APIKEY_MAINTENANCE:"ROLE_APIKEY_MAINTENANCE",ROLE_APIKEY_ADMIN:"ROLE_APIKEY_ADMIN"}),It=Nt;var bt=Object.freeze({TRY_AND_BUY:"TryAndBuy",SUBSCRIPTION:"Subscription",RENTAL:"Rental",FLOATING:"Floating",MULTI_FEATURE:"MultiFeature",PAY_PER_USE:"PayPerUse",PRICING_TABLE:"PricingTable",QUOTA:"Quota",NODE_LOCKED:"NodeLocked",DISCOUNT:"Discount"}),Lt=bt;var Rt=Object.freeze({PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),Ct=Rt;var xt=Object.freeze({NULL:"NULL",PAYPAL:"PAYPAL",PAYPAL_SANDBOX:"PAYPAL_SANDBOX",STRIPE:"STRIPE",STRIPE_TESTING:"STRIPE_TESTING"}),St=xt;var At=n=>n==="true"||n==="false",Mt=n=>n==="null",$e=n=>{let e=n.trim();return e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")},qe=n=>{let e=n.trim();if(!e)return!1;let o=Number(e);return Number.isFinite(o)},Ot=n=>qe(n)?Number(n):n,_t=n=>n==="true"?!0:n==="false"?!1:n,Ut=n=>n==="null"?null:n,wt=n=>{if(!$e(n))return n;try{return JSON.parse(n)}catch{return n}},jt=n=>{if(At(n))return n==="true";if(Mt(n))return null;if(qe(n))return Number(n);if($e(n))try{return JSON.parse(n)}catch{return n}return n},kt=(n,e="auto")=>{switch(e){case"string":return n;case"number":return Ot(n);case"boolean":return _t(n);case"null":return Ut(n);case"json":return wt(n);default:return jt(n)}},Ye=kt;var Vt=(n,e={})=>{let o={};return n?.forEach(({name:t,value:s})=>{o[t]=Ye(s,e[t])}),o},Bt=(n,e={})=>{let o={};return n?.forEach(t=>{let{name:s}=t;o[s]=o[s]||[],o[s].push(Fe(t,e))}),o},Fe=(n,e={})=>n?{...Vt(n.property,e),...Bt(n.list,e)}:{},T=Fe;var ge=(n,e)=>Object.hasOwn(n,e),c=(n,e,o)=>{n[e]=o},r=(n,e,o)=>ge(n,e)?n[e]:o;var D=(n,e={})=>{let o={},{ignore:t=[]}=e;return Object.entries(n).forEach(([s,i])=>{if(!t.includes(s)&&typeof i!="function")if(i===void 0)o[s]="";else if(typeof i=="string")o[s]=i;else if(i instanceof Date)o[s]=i.toISOString();else if(typeof i!="object"||i===null)o[s]=String(i);else try{o[s]=JSON.stringify(i)}catch{o[s]=String(i)}}),o};var $t=function(n,e,o={},t){let s={set:[],get:[]};t?.get&&s.get.push(t.get),t?.set&&s.set.push(t.set);let i={set(a,d){c(n,a,d)},get(a,d){return r(n,a,d)},has(a){return ge(n,a)},setProperty(a,d){this.set(a,d)},addProperty(a,d){this.set(a,d)},getProperty(a,d){return this.get(a,d)},hasProperty(a){return this.has(a)},setProperties(a){Object.entries(a).forEach(([d,l])=>{this.set(d,l)})},serialize(){return D(n)}};return new Proxy(n,{get(a,d,l){return Object.hasOwn(e,d)?e[d]:Object.hasOwn(i,d)?i[d]:(s.get.forEach(f=>{f(a,d,l)}),Reflect.get(a,d,l))},set(a,d,l,f){return s.set.forEach(v=>{v(a,d,l,f)}),Reflect.set(a,d,l,f)},getPrototypeOf(){return o.prototype||null}})},P=$t;var He=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setLicenseTemplateNumbers(t){c(e,"licenseTemplateNumbers",t)},addLicenseTemplateNumber(t){e.licenseTemplateNumbers||(e.licenseTemplateNumbers=[]),e.licenseTemplateNumbers.push(t)},getLicenseTemplateNumbers(t){return r(e,"licenseTemplateNumbers",t)},removeLicenseTemplateNumber(t){let{licenseTemplateNumbers:s=[]}=e;s.splice(s.indexOf(t),1),e.licenseTemplateNumbers=s},getStaleLicenseTemplateNumbers(t){return r(e,"staleLicenseTemplateNumbers",t)},serialize(){let t={};return e.licenseTemplateNumbers&&(t.licenseTemplateNumbers=e.licenseTemplateNumbers.join(",")),D({...e,...t},{ignore:["staleLicenseTemplateNumbers"]})}},He)},Te=He;var C=n=>{let e=T(n,{active:"boolean",number:"string",name:"string",price:"number",currency:"string",productNumber:"string",licenseTemplateNumbers:"string",staleLicenseTemplateNumbers:"string"}),{licenseTemplateNumbers:o,staleLicenseTemplateNumbers:t}=e;return o&&typeof o=="string"&&(e.licenseTemplateNumbers=o.split(",")),t&&typeof t=="string"&&(e.staleLicenseTemplateNumbers=t.split(",")),Te(e)};var Ke=function(n={}){let o={...{code:"",name:"",vatPercent:0,isEu:!1},...n};return P(o,{getCode(){return o.code},getName(){return o.name},getVatPercent(){return o.vatPercent},getIsEu(){return o.isEu}},Ke)},Pe=Ke;var ye=n=>Pe(T(n,{code:"string",name:"string",vatPercent:"number",isEu:"boolean"}));var ze=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setHidden(t){c(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setLicenseeNumber(t){c(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setLicenseTemplateNumber(t){c(e,"licenseTemplateNumber",t)},getLicenseTemplateNumber(t){return r(e,"licenseTemplateNumber",t)},setProductModuleNumber(t){c(e,"productModuleNumber",t)},getProductModuleNumber(t){return r(e,"productModuleNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},ze)},V=ze;var L=n=>{let e=T(n,{active:"boolean",number:"string",name:"string",price:"number",currency:"string",hidden:"boolean",licenseeNumber:"string",licenseTemplateNumber:"string",productModuleNumber:"string",startDate:"string",inUse:"boolean"}),{startDate:o}=e;return o&&typeof o=="string"&&(e.startDate=o==="now"?o:new Date(o)),V(e)};var Je=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setMarkedForTransfer(t){c(e,"markedForTransfer",t)},getMarkedForTransfer(t){return r(e,"markedForTransfer",t)},serialize(){return D(e,{ignore:["inUse"]})}},Je)},Ee=Je;var x=n=>{let e=T(n,{active:"boolean",number:"string",name:"string",markedForTransfer:"boolean",productNumber:"string",aliases:"string",inUse:"boolean"}),{aliases:o}=e;return o&&typeof o=="string"&&(e.aliases=o.split(",")),Ee(e)};var Ge=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setLicenseType(t){c(e,"licenseType",t)},getLicenseType(t){return r(e,"licenseType",t)},setPrice(t){c(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAutomatic(t){c(e,"automatic",t)},getAutomatic(t){return r(e,"automatic",t)},setHidden(t){c(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setHideLicenses(t){c(e,"hideLicenses",t)},getHideLicenses(t){return r(e,"hideLicenses",t)},setProductModuleNumber(t){c(e,"productModuleNumber",t)},getProductModuleNumber(t){return r(e,"productModuleNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},Ge)},De=Ge;var S=n=>De(T(n,{active:"boolean",number:"string",name:"string",licenseType:"string",price:"number",currency:"string",automatic:"boolean",hidden:"boolean",hideLicenses:"boolean",productModuleNumber:"string",inUse:"boolean"}));var We=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setProtocol(t){c(e,"protocol",t)},getProtocol(t){return r(e,"protocol",t)},setEvents(t){c(e,"events",t)},getEvents(t){return r(e,"events",t)},addEvent(t){let s=this.getEvents([]);s.push(t),this.setEvents(s)},setPayload(t){c(e,"payload",t)},getPayload(t){return r(e,"payload",t)},setEndpoint(t){c(e,"endpoint",t)},getEndpoint(t){return r(e,"endpoint",t)},serialize(){let t=D(e);return t.events&&(t.events=this.getEvents([]).join(",")),t}},We)},ve=We;var A=n=>{let e=T(n,{active:"boolean",number:"string",name:"string",protocol:"string",events:"string",payload:"string",endpoint:"string"}),{events:o}=e;return o&&typeof o=="string"&&(e.events=o.split(",")),ve(e)};var Qe=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)}},Qe)},he=Qe;var B=n=>he(T(n,{active:"boolean",number:"string"}));var Xe=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setVersion(t){c(e,"version",t)},getVersion(t){return r(e,"version",t)},setDescription(t){c(e,"description",t)},getDescription(t){return r(e,"description",t)},setLicensingInfo(t){c(e,"licensingInfo",t)},getLicensingInfo(t){return r(e,"licensingInfo",t)},setLicenseeAutoCreate(t){c(e,"licenseeAutoCreate",t)},getLicenseeAutoCreate(t){return r(e,"licenseeAutoCreate",t)},setDiscounts(t){c(e,"discounts",t)},getDiscounts(t){return r(e,"discounts",t)},addDiscount(t){let s=this.getDiscounts([]);s.push(t),this.setDiscounts(s)},removeDiscount(t){let s=this.getDiscounts();Array.isArray(s)&&s.length>0&&(s.splice(s.indexOf(t),1),this.setDiscounts(s))},setProductDiscounts(t){this.setDiscounts(t)},getProductDiscounts(t){return this.getDiscounts(t)},serialize(){let t=D(e,{ignore:["discounts","inUse"]}),s=this.getDiscounts();return s&&(t.discount=s.length>0?s.map(i=>i.toString()):""),t}},Xe)},Ne=Xe;import{AxiosError as qt}from"axios";var h=class n extends qt{constructor(o,t,s,i,a,d){super(o,t,s,i,a);this.isNlicError=!0;this.name="NlicError",d&&(this.stack=d),Object.setPrototypeOf(this,n.prototype)}};var Ze=function(n={}){let e={...n};if(e.amountFix&&e.amountPercent)throw new h('Properties "amountFix" and "amountPercent" cannot be used at the same time');return P(e,{setTotalPrice(t){c(e,"totalPrice",t)},getTotalPrice(t){return r(e,"totalPrice",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAmountFix(t){c(e,"amountFix",t)},getAmountFix(t){return r(e,"amountFix",t)},setAmountPercent(t){c(e,"amountPercent",t)},getAmountPercent(t){return r(e,"amountPercent",t)},toString(){let t=this.getTotalPrice(),s=this.getCurrency(),i=this.getAmountPercent()?`${this.getAmountPercent()}%`:this.getAmountFix();return t&&s&&i?`${t};${s};${i}`:""}},Ze,{set:(t,s)=>{s==="amountFix"&&delete t.amountPercent,s==="amountPercent"&&delete t.amountFix}})},Ie=Ze;var M=n=>{let e=T(n,{number:"string",name:"string",version:"string",description:"string",licensingInfo:"string",licenseeAutoCreate:"boolean",inUse:"boolean"}),o=e.discount;return delete e.discount,o&&(e.discounts=o.map(t=>Ie(t))),Ne(e)};var et=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){c(e,"name",t)},getName(t){return r(e,"name",t)},setLicensingModel(t){c(e,"licensingModel",t)},getLicensingModel(t){return r(e,"licensingModel",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},serialize(){return D(e,{ignore:["inUse"]})}},et)},be=et;var O=n=>be(T(n,{active:"boolean",number:"string",name:"string",licensingModel:"string",productNumber:"string",inUse:"boolean"}));var tt=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setExpirationTime(t){c(e,"expirationTime",t)},getExpirationTime(t){return r(e,"expirationTime",t)},setTokenType(t){c(e,"tokenType",t)},getTokenType(t){return r(e,"tokenType",t)},setLicenseeNumber(t){c(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setAction(t){c(e,"action",t)},getAction(t){return r(e,"action",t)},setApiKeyRole(t){c(e,"apiKeyRole",t)},getApiKeyRole(t){return r(e,"apiKeyRole",t)},setBundleNumber(t){c(e,"bundleNumber",t)},getBundleNumber(t){return r(e,"bundleNumber",t)},setBundlePrice(t){c(e,"bundlePrice",t)},getBundlePrice(t){return r(e,"bundlePrice",t)},setProductNumber(t){c(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setPredefinedShoppingItem(t){c(e,"predefinedShoppingItem",t)},getPredefinedShoppingItem(t){return r(e,"predefinedShoppingItem",t)},setSuccessURL(t){c(e,"successURL",t)},getSuccessURL(t){return r(e,"successURL",t)},setSuccessURLTitle(t){c(e,"successURLTitle",t)},getSuccessURLTitle(t){return r(e,"successURLTitle",t)},setCancelURL(t){c(e,"cancelURL",t)},getCancelURL(t){return r(e,"cancelURL",t)},setCancelURLTitle(t){c(e,"cancelURLTitle",t)},getCancelURLTitle(t){return r(e,"cancelURLTitle",t)},getShopURL(t){return r(e,"shopURL",t)},serialize(){return D(e,{ignore:["shopURL"]})}},tt)},Le=tt;var $=n=>{let e=T(n,{active:"boolean",number:"string",expirationTime:"string",tokenType:"string",licenseeNumber:"string",action:"string",apiKeyRole:"string",bundleNumber:"string",bundlePrice:"number",productNumber:"string",predefinedShoppingItem:"string",successURL:"string",successURLTitle:"string",cancelURL:"string",cancelURLTitle:"string",shopURL:"string"}),{expirationTime:o}=e;return o&&typeof o=="string"&&(e.expirationTime=new Date(o)),Le(e)};var Re=class{constructor(e,o){this.transaction=e,this.license=o}setTransaction(e){this.transaction=e}getTransaction(){return this.transaction}setLicense(e){this.license=e}getLicense(){return this.license}},Ce=(n,e)=>new Re(n,e);var nt=function(n={}){let e={...n};return P(e,{setActive(t){c(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){c(e,"number",t)},getNumber(t){return r(e,"number",t)},setStatus(t){c(e,"status",t)},getStatus(t){return r(e,"status",t)},setSource(t){c(e,"source",t)},getSource(t){return r(e,"source",t)},setGrandTotal(t){c(e,"grandTotal",t)},getGrandTotal(t){return r(e,"grandTotal",t)},setDiscount(t){c(e,"discount",t)},getDiscount(t){return r(e,"discount",t)},setCurrency(t){c(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setDateCreated(t){c(e,"dateCreated",t)},getDateCreated(t){return r(e,"dateCreated",t)},setDateClosed(t){c(e,"dateClosed",t)},getDateClosed(t){return r(e,"dateClosed",t)},setPaymentMethod(t){c(e,"paymentMethod",t)},getPaymentMethod(t){return r(e,"paymentMethod",t)},setLicenseTransactionJoins(t){c(e,"licenseTransactionJoins",t)},getLicenseTransactionJoins(t){return r(e,"licenseTransactionJoins",t)},serialize(){let t={...e};return t.datecreated=e.dateCreated,t.dateclosed=e.dateClosed,delete t.dateCreated,delete t.dateClosed,D(t,{ignore:["licenseTransactionJoins","inUse"]})}},nt)},X=nt;var _=n=>{let e=T(n,{active:"boolean",number:"string",status:"string",source:"string",grandTotal:"number",discount:"number",currency:"string",datecreated:"string",dateclosed:"string",paymentMethod:"string",licenseTransactionJoins:"json",inUse:"boolean"}),{datecreated:o,dateclosed:t}=e;o&&typeof o=="string"&&(e.dateCreated=new Date(o),delete e.datecreated),t&&typeof t=="string"&&(e.dateClosed=new Date(t),delete e.dateclosed);let s=e.licenseTransactionJoin;return delete e.licenseTransactionJoin,s&&(e.licenseTransactionJoins=s.map(({transactionNumber:i,licenseNumber:a})=>{let d=X({number:String(i)}),l=V({number:String(a)});return Ce(d,l)})),X(e)};import Yt from"axios";var ot=Yt.create(),st=null,it=[],rt=n=>{ot=n},Z=()=>ot,xe=n=>{st=n},at=()=>st,Se=n=>{it=n},ct=()=>it;var Ae={name:"netlicensing-client",version:"2.0.2",description:"JavaScript Wrapper for Labs64 NetLicensing RESTful API",keywords:["labs64","netlicensing","licensing","licensing-as-a-service","license","license-management","software-license","client","restful","restful-api","javascript","wrapper","api","client"],license:"Apache-2.0",author:"Labs64 GmbH",homepage:"https://netlicensing.io",repository:{type:"git",url:"git+https://github.com/Labs64/NetLicensingClient-javascript.git"},bugs:{url:"https://github.com/Labs64/NetLicensingClient-javascript/issues"},contributors:[{name:"Ready Brown",email:"ready.brown@hotmail.de",url:"https://github.com/r-brown"},{name:"Viacheslav Rudkovskiy",email:"viachaslau.rudkovski@labs64.de",url:"https://github.com/v-rudkovskiy"},{name:"Andrei Yushkevich",email:"yushkevich@me.com",url:"https://github.com/yushkevich"}],main:"dist/index.cjs",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"}},files:["dist"],scripts:{build:"tsup",release:"npm run lint:typecheck && npm run test && npm run build",dev:"tsup --watch",test:"vitest run","test:dev":"vitest watch",lint:"eslint --ext .js,.mjs,.ts src",typecheck:"tsc --noEmit","lint:typecheck":"npm run lint && npm run typecheck"},peerDependencies:{axios:"^1.9.0"},dependencies:{},devDependencies:{"@eslint/js":"^9.39.4","@types/node":"^25.3.5","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.29.1","@vitest/eslint-plugin":"^1.1.43",axios:"^1.13.6",eslint:"^9.39.4","eslint-plugin-import":"^2.31.0",prettier:"3.8.1",tsup:"^8.4.0",typescript:"^5.8.3","typescript-eslint":"^8.29.1",vitest:"^3.2.4"},engines:{node:">= 16.9.0",npm:">= 8.0.0"},browserslist:["> 1%","last 2 versions","not ie <= 10"]};var ee=n=>{let e=[],o=(t,s)=>{if(t!=null){if(Array.isArray(t)){t.forEach(i=>{o(i,s?`${s}`:"")});return}if(t instanceof Date){e.push(`${s}=${encodeURIComponent(t.toISOString())}`);return}if(typeof t=="object"){Object.keys(t).forEach(i=>{let a=t[i];o(a,s?`${s}[${encodeURIComponent(i)}]`:encodeURIComponent(i))});return}e.push(`${s}=${encodeURIComponent(t)}`)}};return o(n),e.join("&")};var U=async(n,e,o,t,s)=>{let i={Accept:"application/json","X-Requested-With":"XMLHttpRequest"};typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(i["User-agent"]=`NetLicensing/Javascript ${Ae.version}/node&${process.version}`);let a={method:e,headers:i,url:encodeURI(`${n.getBaseUrl()}/${o}`),responseType:"json",transformRequest:(l,f)=>f["Content-Type"]==="application/x-www-form-urlencoded"?ee(l):(f["NetLicensing-Origin"]||(f["NetLicensing-Origin"]=`NetLicensing/Javascript ${Ae.version}`),l)};switch(["put","post","patch"].indexOf(e.toLowerCase())>=0?(a.method==="post"&&(i["Content-Type"]="application/x-www-form-urlencoded"),a.data=t):a.params=t,n.getSecurityMode()){case N.BASIC_AUTHENTICATION:{if(!n.getUsername())throw new h('Missing parameter "username"');if(!n.getPassword())throw new h('Missing parameter "password"');a.auth={username:n.getUsername(),password:n.getPassword()}}break;case N.APIKEY_IDENTIFICATION:if(!n.getApiKey())throw new h('Missing parameter "apiKey"');i.Authorization=`Basic ${btoa(`apiKey:${n.getApiKey()}`)}`;break;case N.ANONYMOUS_IDENTIFICATION:break;default:throw new h("Unknown security mode")}let d=s?.axiosInstance||Z();try{let l=await d.request(a),f=l.data.infos?.info||[];if(xe(l),Se(f),s?.onResponse&&s.onResponse(l),f.length>0){s?.onInfo&&s.onInfo(f);let v=f.find(({type:I})=>I==="ERROR");if(v)throw new h(v.value,v.id,l.config,l.request,l)}return l}catch(l){let f=l,v=f.response,I=v?.data?.infos?.info||[];if(xe(v||null),Se(I),l.isAxiosError){let b=l.message;if(v?.data&&I.length>0){let j=I.find(({type:k})=>k==="ERROR");j&&(b=j.value)}throw new h(b,f.code,f.config,f.request,f.response)}throw l}};var dt=(n,e,o,t)=>U(n,"get",e,o,t),mt=(n,e,o,t)=>U(n,"post",e,o,t),ut=(n,e,o,t)=>U(n,"delete",e,o,t);var Ht={setAxiosInstance(n){rt(n)},getAxiosInstance(){return Z()},getLastHttpRequestInfo(){return at()},getInfo(){return ct()},get(n,e,o,t){return dt(n,e,o,t)},post(n,e,o,t){return mt(n,e,o,t)},delete(n,e,o,t){return ut(n,e,o,t)},request(n,e,o,t,s){return U(n,e,o,t,s)},toQueryString(n){return ee(n)}},m=Ht;var E=n=>Object.keys(n).map(e=>`${e}=${String(n[e])}`).join(";"),Kt=n=>{let e={};return n.split(";").forEach(o=>{let[t,s]=o.split("=");e[t]=s}),e};var pt=n=>typeof n<"u"&&typeof n!="function",te=n=>pt(n)?typeof n=="number"?!Number.isNaN(n):!0:!1,g=(n,e)=>{if(n===null)throw new TypeError(`Parameter "${e}" cannot be null.`);if(!te(n))throw new TypeError(`Parameter "${e}" has an invalid value.`)},p=(n,e)=>{if(g(n,e),!n)throw new TypeError(`Parameter "${e}" cannot be empty.`)};var lt=function(n,e){let o=parseInt(e?.pagenumber||"0",10),t=parseInt(e?.itemsnumber||"0",10),s=parseInt(e?.totalpages||"0",10),i=parseInt(e?.totalitems||"0",10),a={getContent(){return n},getPagination(){return{pageNumber:o,itemsNumber:t,totalPages:s,totalItems:i,hasNext:s>o+1}},getPageNumber(){return o},getItemsNumber(){return t},getTotalPages(){return s},getTotalItems(){return i},hasNext(){return s>o+1}};return new Proxy(n,{get(d,l,f){return Object.hasOwn(a,l)?a[l]:Reflect.get(d,l,f)},set(d,l,f,v){return Reflect.set(d,l,f,v)},getPrototypeOf(){return lt.prototype||null}})},y=lt;var w=u.Bundle.ENDPOINT_PATH,zt=u.Bundle.ENDPOINT_OBTAIN_PATH,ne=u.Bundle.TYPE,Jt={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${w}/${e}`,{},o)).data.items?.item.find(i=>i.type===ne);return C(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,w,t,o)).data.items,a=i?.item.filter(d=>d.type===ne).map(d=>C(d));return y(a||[],i)},async create(n,e,o){g(e,"bundle");let s=(await m.post(n,w,e.serialize(),o)).data.items?.item.find(i=>i.type===ne);return C(s)},async update(n,e,o,t){p(e,"number"),g(o,"bundle");let i=(await m.post(n,`${w}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ne);return C(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${w}/${e}`,{forceCascade:!!o},t)},async obtain(n,e,o,t){p(e,"number"),p(o,"licenseeNumber");let s={[u.Licensee.LICENSEE_NUMBER]:o};return(await m.post(n,`${w}/${e}/${zt}`,s,t)).data.items?.item.filter(l=>l.type===u.License.TYPE)?.map(l=>L(l))||[]}},Gt=Jt;var Me=class{constructor(){this.validations={}}getValidators(){return this.validations}setValidation(e){return this.validations[e.productModuleNumber]=e,this}getValidation(e,o){return this.validations[e]||o}setProductModuleValidation(e){return this.setValidation(e)}getProductModuleValidation(e,o){return this.getValidation(e,o)}setTtl(e){if(!te(e))throw new TypeError(`Bad ttl:${e.toString()}`);return this.ttl=new Date(e),this}getTtl(){return this.ttl}toString(){let e="ValidationResult [";return Object.keys(this.validations).forEach(o=>{e+=`ProductModule<${o}>`,o in this.validations&&(e+=JSON.stringify(this.validations[o]))}),e+="]",e}},Oe=()=>new Me;var R=u.Licensee.ENDPOINT_PATH,Wt=u.Licensee.ENDPOINT_PATH_VALIDATE,Qt=u.Licensee.ENDPOINT_PATH_TRANSFER,oe=u.Licensee.TYPE,Xt={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${R}/${e}`,{},o)).data.items?.item.find(i=>i.type===oe);return x(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,R,t,o)).data.items,a=i?.item.filter(d=>d.type===oe).map(d=>x(d));return y(a||[],i)},async create(n,e,o,t){g(o,"licensee");let s=o.serialize();e&&(s.productNumber=e);let a=(await m.post(n,R,s,t)).data.items?.item.find(d=>d.type===oe);return x(a)},async update(n,e,o,t){p(e,"number"),g(o,"licensee");let i=(await m.post(n,`${R}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===oe);return x(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${R}/${e}`,{forceCascade:!!o},t)},async validate(n,e,o,t){p(e,"number");let s={};if(o){let f=o.productNumber;f&&(s.productNumber=f);let v=o.licenseeProperties;Object.keys(v).forEach(b=>{s[b]=o.getLicenseeProperty(b)}),o.isForOfflineUse()&&(s.forOfflineUse=!0),o.isDryRun()&&(s.dryRun=!0);let I=o.getParameters();Object.keys(I).forEach((b,j)=>{s[`${u.ProductModule.PRODUCT_MODULE_NUMBER}${j}`]=b;let k=I[b];k&&Object.keys(k).forEach(Be=>{s[Be+j]=k[Be]})})}let i=await m.post(n,`${R}/${e}/${Wt}`,s,t),a=Oe(),d=i.data.ttl;return d&&a.setTtl(d),i.data.items?.item.filter(f=>f.type===u.Validation.TYPE)?.forEach(f=>{a.setValidation(T(f))}),a},transfer(n,e,o,t){p(e,"number"),p(o,"sourceLicenseeNumber");let s={sourceLicenseeNumber:o};return m.post(n,`${R}/${e}/${Qt}`,s,t)}},Zt=Xt;var q=u.License.ENDPOINT_PATH,se=u.License.TYPE,en={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${q}/${e}`,{},o)).data.items?.item.find(i=>i.type===se);return L(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,q,t,o)).data.items,a=i?.item.filter(d=>d.type===se).map(d=>L(d));return y(a||[],i)},async create(n,e,o,t,s,i){g(s,"license");let a=s.serialize();e&&(a.licenseeNumber=e),o&&(a.licenseTemplateNumber=o),t&&(a.transactionNumber=t);let l=(await m.post(n,q,a,i)).data.items?.item.find(f=>f.type===se);return L(l)},async update(n,e,o,t,s){p(e,"number"),g(t,"license");let i=t.serialize();o&&(i.transactionNumber=o);let d=(await m.post(n,`${q}/${e}`,i,s)).data.items?.item.find(l=>l.type===se);return L(d)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${q}/${e}`,{forceCascade:!!o},t)}},tn=en;var Y=u.LicenseTemplate.ENDPOINT_PATH,ie=u.LicenseTemplate.TYPE,nn={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${Y}/${e}`,{},o)).data.items?.item.find(i=>i.type===ie);return S(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,Y,t,o)).data.items,a=i?.item.filter(d=>d.type===ie).map(d=>S(d));return y(a||[],i)},async create(n,e,o,t){g(o,"licenseTemplate");let s=o.serialize();e&&(s.productModuleNumber=e);let a=(await m.post(n,Y,s,t)).data.items?.item.find(d=>d.type===ie);return S(a)},async update(n,e,o,t){p(e,"number"),g(o,"licenseTemplate");let i=(await m.post(n,`${Y}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ie);return S(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${Y}/${e}`,{forceCascade:!!o},t)}},on=nn;var F=u.Notification.ENDPOINT_PATH,re=u.Notification.TYPE,sn={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${F}/${e}`,{},o)).data.items?.item.find(i=>i.type===re);return A(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,F,t,o)).data.items,a=i?.item.filter(d=>d.type===re).map(d=>A(d));return y(a||[],i)},async create(n,e,o){g(e,"notification");let s=(await m.post(n,F,e.serialize(),o)).data.items?.item.find(i=>i.type===re);return A(s)},async update(n,e,o,t){p(e,"number"),g(o,"notification");let i=(await m.post(n,`${F}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===re);return A(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${F}/${e}`,{forceCascade:!!o},t)}},rn=sn;var _e=u.PaymentMethod.ENDPOINT_PATH,Ue=u.PaymentMethod.TYPE,an={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${_e}/${e}`,{},o)).data.items?.item.find(i=>i.type===Ue);return B(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,_e,t,o)).data.items,a=i?.item.filter(d=>d.type===Ue).map(d=>B(d));return y(a||[],i)},async update(n,e,o,t){p(e,"number"),g(o,"paymentMethod");let i=(await m.post(n,`${_e}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===Ue);return B(i)}},cn=an;var H=u.ProductModule.ENDPOINT_PATH,ae=u.ProductModule.TYPE,dn={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${H}/${e}`,{},o)).data.items?.item.find(i=>i.type===ae);return O(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,H,t,o)).data.items,a=i?.item.filter(d=>d.type===ae).map(d=>O(d));return y(a||[],i)},async create(n,e,o,t){g(o,"productModule");let s=o.serialize();e&&(s.productNumber=e);let a=(await m.post(n,H,s,t)).data.items?.item.find(d=>d.type===ae);return O(a)},async update(n,e,o,t){p(e,"number"),g(o,"productModule");let i=(await m.post(n,`${H}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ae);return O(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${H}/${e}`,{forceCascade:!!o},t)}},mn=dn;var K=u.Product.ENDPOINT_PATH,ce=u.Product.TYPE,un={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${K}/${e}`,{},o)).data.items?.item.find(i=>i.type===ce);return M(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,K,t,o)).data.items,a=i?.item.filter(d=>d.type===ce).map(d=>M(d));return y(a||[],i)},async create(n,e,o){g(e,"product");let s=(await m.post(n,K,e.serialize(),o)).data.items?.item.find(i=>i.type===ce);return M(s)},async update(n,e,o,t){p(e,"number"),g(o,"product");let i=(await m.post(n,`${K}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ce);return M(i)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${K}/${e}`,{forceCascade:!!o},t)}},pn=un;var de=u.Token.ENDPOINT_PATH,we=u.Token.TYPE,ln={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${de}/${e}`,{},o)).data.items?.item.find(i=>i.type===we);return $(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,de,t,o)).data.items,a=i?.item.filter(d=>d.type===we).map(d=>$(d));return y(a||[],i)},async create(n,e,o){g(e,"token");let s=(await m.post(n,de,e.serialize(),o)).data.items?.item.find(i=>i.type===we);return $(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${de}/${e}`,{forceCascade:!!o},t)}},fn=ln;var me=u.Transaction.ENDPOINT_PATH,ue=u.Transaction.TYPE,gn={async get(n,e,o){p(e,"number");let s=(await m.get(n,`${me}/${e}`,{},o)).data.items?.item.find(i=>i.type===ue);return _(s)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let i=(await m.get(n,me,t,o)).data.items,a=i?.item.filter(d=>d.type===ue).map(d=>_(d));return y(a||[],i)},async create(n,e,o){g(e,"transaction");let s=(await m.post(n,me,e.serialize(),o)).data.items?.item.find(i=>i.type===ue);return _(s)},async update(n,e,o,t){p(e,"number"),g(o,"transaction");let i=(await m.post(n,`${me}/${e}`,o.serialize(),t)).data.items?.item.find(a=>a.type===ue);return _(i)}},Tn=gn;var je=u.Utility.ENDPOINT_PATH,Pn={async listLicenseTypes(n,e){let o=`${je}/${u.Utility.ENDPOINT_PATH_LICENSE_TYPES}`,s=(await m.get(n,o,void 0,e)).data.items,i=u.Utility.LICENSE_TYPE,a=s?.item.filter(d=>d.type===i).map(d=>T(d).name);return y(a||[],s)},async listLicensingModels(n,e){let o=`${je}/${u.Utility.ENDPOINT_PATH_LICENSING_MODELS}`,s=(await m.get(n,o,void 0,e)).data.items,i=u.Utility.LICENSING_MODEL_TYPE,a=s?.item.filter(d=>d.type===i).map(d=>T(d).name);return y(a||[],s)},async listCountries(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:E(e));let s=`${je}/${u.Utility.ENDPOINT_PATH_COUNTRIES}`,a=(await m.get(n,s,t,o)).data.items,d=u.Utility.COUNTRY_TYPE,l=a?.item.filter(f=>f.type===d).map(f=>ye(f));return y(l||[],a)}},yn=Pn;var ke=class{constructor(e){this.baseUrl=e?.baseUrl||"https://go.netlicensing.io/core/v2/rest",this.securityMode=e?.securityMode||N.BASIC_AUTHENTICATION,this.username=e?.username,this.password=e?.password,this.apiKey=e?.apiKey,this.publicKey=e?.publicKey}setBaseUrl(e){return this.baseUrl=e,this}getBaseUrl(){return this.baseUrl}setSecurityMode(e){return this.securityMode=e,this}getSecurityMode(){return this.securityMode}setUsername(e){return this.username=e,this}getUsername(e){return this.username||e}setPassword(e){return this.password=e,this}getPassword(e){return this.password||e}setApiKey(e){return this.apiKey=e,this}getApiKey(e){return this.apiKey||e}setPublicKey(e){return this.publicKey=e,this}getPublicKey(e){return this.publicKey||e}},En=n=>new ke(n);var Ve=class{constructor(){this.parameters={},this.licenseeProperties={}}setProductNumber(e){return this.productNumber=e,this}getProductNumber(){return this.productNumber}setLicenseeName(e){return this.licenseeProperties.licenseeName=e,this}getLicenseeName(){return this.licenseeProperties.licenseeName}setLicenseeSecret(e){return this.licenseeProperties.licenseeSecret=e,this}getLicenseeSecret(){return this.licenseeProperties.licenseeSecret}getLicenseeProperties(){return this.licenseeProperties}setLicenseeProperty(e,o){return this.licenseeProperties[e]=o,this}getLicenseeProperty(e,o){return this.licenseeProperties[e]||o}setForOfflineUse(e){return this.forOfflineUse=e,this}isForOfflineUse(){return!!this.forOfflineUse}setDryRun(e){return this.dryRun=e,this}isDryRun(){return!!this.dryRun}getParameters(){return this.parameters}setParameter(e,o){return this.parameters[e]=o,this}getParameter(e){return this.parameters[e]}getProductModuleValidationParameters(e){return this.getParameter(e)}setProductModuleValidationParameters(e,o){return this.setParameter(e,o)}},Dn=()=>new Ve;export{It as ApiKeyRole,Te as Bundle,Gt as BundleService,u as Constants,En as Context,Pe as Country,V as License,tn as LicenseService,De as LicenseTemplate,on as LicenseTemplateService,Ce as LicenseTransactionJoin,z as LicenseType,Ee as Licensee,pe as LicenseeSecretMode,Zt as LicenseeService,Lt as LicensingModel,h as NlicError,Ct as NodeSecretMode,ve as Notification,J as NotificationEvent,G as NotificationProtocol,rn as NotificationService,y as Page,he as PaymentMethod,St as PaymentMethodEnum,cn as PaymentMethodService,Ne as Product,Ie as ProductDiscount,be as ProductModule,mn as ProductModuleService,pn as ProductService,N as SecurityMode,m as Service,le as TimeVolumePeriod,Le as Token,fn as TokenService,W as TokenType,X as Transaction,Tn as TransactionService,fe as TransactionSource,Q as TransactionStatus,yn as UtilityService,Dn as ValidationParameters,Oe as ValidationResults,P as defineEntity,p as ensureNotEmpty,g as ensureNotNull,Kt as filterDecode,E as filterEncode,pt as isDefined,te as isValid,C as itemToBundle,ye as itemToCountry,L as itemToLicense,S as itemToLicenseTemplate,x as itemToLicensee,A as itemToNotification,T as itemToObject,B as itemToPaymentMethod,M as itemToProduct,O as itemToProductModule,$ as itemToToken,_ as itemToTransaction,D as serialize};
2
2
  //# sourceMappingURL=index.mjs.map