netlicensing-client 1.2.38 → 2.0.0
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.d.mts +1797 -0
- package/dist/index.d.ts +1797 -0
- package/dist/index.global.js +7 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +95 -116
- package/dist/netlicensing-client.js +0 -11228
- package/dist/netlicensing-client.min.js +0 -2
- package/dist/netlicensing-client.min.js.LICENSE.txt +0 -8
- package/dist/netlicensing-client.node.js +0 -16960
- package/dist/netlicensing-client.node.min.js +0 -2
- package/dist/netlicensing-client.node.min.js.LICENSE.txt +0 -22
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var lt=Object.freeze({DISABLED:"DISABLED",PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),pe=lt;var ft=Object.freeze({FEATURE:"FEATURE",TIMEVOLUME:"TIMEVOLUME",FLOATING:"FLOATING",QUANTITY:"QUANTITY"}),z=ft;var Tt=Object.freeze({LICENSEE_CREATED:"LICENSEE_CREATED",LICENSE_CREATED:"LICENSE_CREATED",WARNING_LEVEL_CHANGED:"WARNING_LEVEL_CHANGED",PAYMENT_TRANSACTION_PROCESSED:"PAYMENT_TRANSACTION_PROCESSED"}),G=Tt;var Pt=Object.freeze({WEBHOOK:"WEBHOOK"}),J=Pt;var gt=Object.freeze({BASIC_AUTHENTICATION:"BASIC_AUTH",APIKEY_IDENTIFICATION:"APIKEY",ANONYMOUS_IDENTIFICATION:"ANONYMOUS"}),N=gt;var yt=Object.freeze({DAY:"DAY",WEEK:"WEEK",MONTH:"MONTH",YEAR:"YEAR"}),le=yt;var Dt=Object.freeze({DEFAULT:"DEFAULT",SHOP:"SHOP",APIKEY:"APIKEY",ACTION:"ACTION"}),Q=Dt;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"}),fe=Et;var vt=Object.freeze({PENDING:"PENDING",CLOSED:"CLOSED",CANCELLED:"CANCELLED"}),W=vt;var u={LicenseeSecretMode:pe,LicenseType:z,NotificationEvent:G,NotificationProtocol:J,SecurityMode:N,TimeVolumePeriod:le,TokenType:Q,TransactionSource:fe,TransactionStatus:W,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:Q},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:W},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 ht=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"}),Nt=ht;var It=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"}),bt=It;var Lt=Object.freeze({PREDEFINED:"PREDEFINED",CLIENT:"CLIENT"}),Rt=Lt;var Ct=Object.freeze({NULL:"NULL",PAYPAL:"PAYPAL",PAYPAL_SANDBOX:"PAYPAL_SANDBOX",STRIPE:"STRIPE",STRIPE_TESTING:"STRIPE_TESTING"}),xt=Ct;var St=n=>{try{return JSON.parse(n)}catch{return n}},At=n=>{let e={};return n?.forEach(({name:o,value:t})=>{e[o]=St(t)}),e},Mt=n=>{let e={};return n?.forEach(o=>{let{name:t}=o;e[t]=e[t]||[],e[t].push(Be(o))}),e},Be=n=>n?{...At(n.property),...Mt(n.list)}:{},P=Be;var Te=(n,e)=>Object.hasOwn(n,e),a=(n,e,o)=>{n[e]=o},r=(n,e,o)=>Te(n,e)?n[e]:o;var E=(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 Ot=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(c,d){a(n,c,d)},get(c,d){return r(n,c,d)},has(c){return Te(n,c)},setProperty(c,d){this.set(c,d)},addProperty(c,d){this.set(c,d)},getProperty(c,d){return this.get(c,d)},hasProperty(c){return this.has(c)},setProperties(c){Object.entries(c).forEach(([d,l])=>{this.set(d,l)})},serialize(){return E(n)}};return new Proxy(n,{get(c,d,l){return Object.hasOwn(e,d)?e[d]:Object.hasOwn(s,d)?s[d]:(i.get.forEach(f=>{f(c,d,l)}),Reflect.get(c,d,l))},set(c,d,l,f){return i.set.forEach(v=>{v(c,d,l,f)}),Reflect.set(c,d,l,f)},getPrototypeOf(){return o.prototype||null}})},g=Ot;var qe=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){a(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){a(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setLicenseTemplateNumbers(t){a(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},serialize(){if(e.licenseTemplateNumbers){let t=e.licenseTemplateNumbers.join(",");return E({...e,licenseTemplateNumbers:t})}return E(e)}},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 ye=n=>ge(P(n));var Fe=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setPrice(t){a(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){a(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setHidden(t){a(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setLicenseeNumber(t){a(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setLicenseTemplateNumber(t){a(e,"licenseTemplateNumber",t)},getLicenseTemplateNumber(t){return r(e,"licenseTemplateNumber",t)},setTimeVolume(t){a(e,"timeVolume",t)},getTimeVolume(t){return r(e,"timeVolume",t)},setTimeVolumePeriod(t){a(e,"timeVolumePeriod",t)},getTimeVolumePeriod(t){return r(e,"timeVolumePeriod",t)},setStartDate(t){a(e,"startDate",t)},getStartDate(t){return r(e,"startDate",t)},setParentfeature(t){a(e,"parentfeature",t)},getParentfeature(t){return r(e,"parentfeature",t)},serialize(){return E(e,{ignore:["inUse"]})}},Fe)},k=Fe;var L=n=>{let e=P(n),{startDate:o}=e;return o&&typeof o=="string"&&(e.startDate=o==="now"?o:new Date(o)),k(e)};var He=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setProductNumber(t){a(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setMarkedForTransfer(t){a(e,"markedForTransfer",t)},getMarkedForTransfer(t){return r(e,"markedForTransfer",t)},serialize(){return E(e,{ignore:["inUse"]})}},He)},De=He;var x=n=>De(P(n));var Ke=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setLicenseType(t){a(e,"licenseType",t)},getLicenseType(t){return r(e,"licenseType",t)},setPrice(t){a(e,"price",t)},getPrice(t){return r(e,"price",t)},setCurrency(t){a(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAutomatic(t){a(e,"automatic",t)},getAutomatic(t){return r(e,"automatic",t)},setHidden(t){a(e,"hidden",t)},getHidden(t){return r(e,"hidden",t)},setHideLicenses(t){a(e,"hideLicenses",t)},getHideLicenses(t){return r(e,"hideLicenses",t)},setGracePeriod(t){a(e,"gracePeriod",t)},getGracePeriod(t){return r(e,"gracePeriod",t)},setTimeVolume(t){a(e,"timeVolume",t)},getTimeVolume(t){return r(e,"timeVolume",t)},setTimeVolumePeriod(t){a(e,"timeVolumePeriod",t)},getTimeVolumePeriod(t){return r(e,"timeVolumePeriod",t)},setMaxSessions(t){a(e,"maxSessions",t)},getMaxSessions(t){return r(e,"maxSessions",t)},setQuantity(t){a(e,"quantity",t)},getQuantity(t){return r(e,"quantity",t)},setProductModuleNumber(t){a(e,"productModuleNumber",t)},getProductModuleNumber(t){return r(e,"productModuleNumber",t)},serialize(){return E(e,{ignore:["inUse"]})}},Ke)},Ee=Ke;var S=n=>Ee(P(n));var ze=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setProtocol(t){a(e,"protocol",t)},getProtocol(t){return r(e,"protocol",t)},setEvents(t){a(e,"events",t)},getEvents(t){return r(e,"events",t)},addEvent(t){let i=this.getEvents([]);i.push(t),this.setEvents(i)},setPayload(t){a(e,"payload",t)},getPayload(t){return r(e,"payload",t)},setEndpoint(t){a(e,"endpoint",t)},getEndpoint(t){return r(e,"endpoint",t)},serialize(){let t=E(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){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(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){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setVersion(t){a(e,"version",t)},getVersion(t){return r(e,"version",t)},setDescription(t){a(e,"description",t)},getDescription(t){return r(e,"description",t)},setLicensingInfo(t){a(e,"licensingInfo",t)},getLicensingInfo(t){return r(e,"licensingInfo",t)},setLicenseeAutoCreate(t){a(e,"licenseeAutoCreate",t)},getLicenseeAutoCreate(t){return r(e,"licenseeAutoCreate",t)},setDiscounts(t){a(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=E(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 _t}from"axios";var h=class n extends _t{constructor(o,t,i,s,c,d){super(o,t,i,s,c);this.isNlicError=!0;this.name="NlicError",d&&(this.stack=d),Object.setPrototypeOf(this,n.prototype)}};var Qe=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){a(e,"totalPrice",t)},getTotalPrice(t){return r(e,"totalPrice",t)},setCurrency(t){a(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setAmountFix(t){a(e,"amountFix",t)},getAmountFix(t){return r(e,"amountFix",t)},setAmountPercent(t){a(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}`:""}},Qe,{set:(t,i)=>{i==="amountFix"&&delete t.amountPercent,i==="amountPercent"&&delete t.amountFix}})},Ie=Qe;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 We=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setName(t){a(e,"name",t)},getName(t){return r(e,"name",t)},setLicensingModel(t){a(e,"licensingModel",t)},getLicensingModel(t){return r(e,"licensingModel",t)},setMaxCheckoutValidity(t){a(e,"maxCheckoutValidity",t)},getMaxCheckoutValidity(t){return r(e,"maxCheckoutValidity",t)},setYellowThreshold(t){a(e,"yellowThreshold",t)},getYellowThreshold(t){return r(e,"yellowThreshold",t)},setRedThreshold(t){a(e,"redThreshold",t)},getRedThreshold(t){return r(e,"redThreshold",t)},setProductNumber(t){a(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},serialize(){return E(e,{ignore:["inUse"]})}},We)},be=We;var O=n=>be(P(n));var Xe=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setExpirationTime(t){a(e,"expirationTime",t)},getExpirationTime(t){return r(e,"expirationTime",t)},setTokenType(t){a(e,"tokenType",t)},getTokenType(t){return r(e,"tokenType",t)},setLicenseeNumber(t){a(e,"licenseeNumber",t)},getLicenseeNumber(t){return r(e,"licenseeNumber",t)},setAction(t){a(e,"action",t)},getAction(t){return r(e,"action",t)},setApiKeyRole(t){a(e,"apiKeyRole",t)},getApiKeyRole(t){return r(e,"apiKeyRole",t)},setBundleNumber(t){a(e,"bundleNumber",t)},getBundleNumber(t){return r(e,"bundleNumber",t)},setBundlePrice(t){a(e,"bundlePrice",t)},getBundlePrice(t){return r(e,"bundlePrice",t)},setProductNumber(t){a(e,"productNumber",t)},getProductNumber(t){return r(e,"productNumber",t)},setPredefinedShoppingItem(t){a(e,"predefinedShoppingItem",t)},getPredefinedShoppingItem(t){return r(e,"predefinedShoppingItem",t)},setSuccessURL(t){a(e,"successURL",t)},getSuccessURL(t){return r(e,"successURL",t)},setSuccessURLTitle(t){a(e,"successURLTitle",t)},getSuccessURLTitle(t){return r(e,"successURLTitle",t)},setCancelURL(t){a(e,"cancelURL",t)},getCancelURL(t){return r(e,"cancelURL",t)},setCancelURLTitle(t){a(e,"cancelURLTitle",t)},getCancelURLTitle(t){return r(e,"cancelURLTitle",t)},getShopURL(t){return r(e,"shopURL",t)},serialize(){return E(e,{ignore:["shopURL"]})}},Xe)},Le=Xe;var B=n=>{let e=P(n),{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 Ze=function(n={}){let e={...n};return g(e,{setActive(t){a(e,"active",t)},getActive(t){return r(e,"active",t)},setNumber(t){a(e,"number",t)},getNumber(t){return r(e,"number",t)},setStatus(t){a(e,"status",t)},getStatus(t){return r(e,"status",t)},setSource(t){a(e,"source",t)},getSource(t){return r(e,"source",t)},setGrandTotal(t){a(e,"grandTotal",t)},getGrandTotal(t){return r(e,"grandTotal",t)},setDiscount(t){a(e,"discount",t)},getDiscount(t){return r(e,"discount",t)},setCurrency(t){a(e,"currency",t)},getCurrency(t){return r(e,"currency",t)},setDateCreated(t){a(e,"dateCreated",t)},getDateCreated(t){return r(e,"dateCreated",t)},setDateClosed(t){a(e,"dateClosed",t)},getDateClosed(t){return r(e,"dateClosed",t)},setPaymentMethod(t){a(e,"paymentMethod",t)},getPaymentMethod(t){return r(e,"paymentMethod",t)},setLicenseTransactionJoins(t){a(e,"licenseTransactionJoins",t)},getLicenseTransactionJoins(t){return r(e,"licenseTransactionJoins",t)},serialize(){return E(e,{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)),t&&typeof t=="string"&&(e.dateClosed=new Date(t));let i=e.licenseTransactionJoin;return delete e.licenseTransactionJoin,i&&(e.licenseTransactionJoins=i.map(({transactionNumber:s,licenseNumber:c})=>{let d=X({number:s}),l=k({number:c});return Ce(d,l)})),X(e)};import wt from"axios";var et=wt.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:"1.2.39",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:"https://github.com/Labs64/NetLicensingClient-javascript"},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.24.0","@types/node":"^22.14.0","@typescript-eslint/eslint-plugin":"^8.29.1","@typescript-eslint/parser":"^8.29.1","@vitest/eslint-plugin":"^1.1.43",axios:"^1.9.0",eslint:"^9.24.0","eslint-plugin-import":"^2.31.0",prettier:"3.5.3",tsup:"^8.4.0",typescript:"^5.8.3","typescript-eslint":"^8.29.1",vitest:"^3.1.1"},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 c=t[s];o(c,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 c={method:e,headers:s,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?(c.method==="post"&&(s["Content-Type"]="application/x-www-form-urlencoded"),c.data=t):c.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"');c.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 l=await d(c),f=l.data.infos?.info||[];if(xe(l),Se(f),i?.onResponse&&i.onResponse(l),f.length>0){i?.onInfo&&i.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 V=I.find(({type:j})=>j==="ERROR");V&&(b=V.value)}throw new h(b,f.code,f.config,f.request,f.response)}throw l}};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 Vt={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=Vt;var dt=";",mt="=",D=n=>Object.keys(n).map(e=>`${e}${mt}${String(n[e])}`).join(dt),jt=n=>{let e={};return n.split(dt).forEach(o=>{let[t,i]=o.split(mt);e[t]=i}),e};var ut=n=>typeof n<"u"&&typeof n!="function",te=n=>ut(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 pt=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),c={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,l,f){return Object.hasOwn(c,l)?c[l]:Reflect.get(d,l,f)},set(d,l,f,v){return Reflect.set(d,l,f,v)},getPrototypeOf(){return pt.prototype||null}})},y=pt;var U=u.Bundle.ENDPOINT_PATH,kt=u.Bundle.ENDPOINT_OBTAIN_PATH,ne=u.Bundle.TYPE,$t={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:D(e));let s=(await m.get(n,U,t,o)).data.items,c=s?.item.filter(d=>d.type===ne).map(d=>C(d));return y(c||[],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(c=>c.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}/${kt}`,i,t)).data.items?.item.filter(l=>l.type===u.License.TYPE)?.map(l=>L(l))||[]}},Bt=$t;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,qt=u.Licensee.ENDPOINT_PATH_VALIDATE,Yt=u.Licensee.ENDPOINT_PATH_TRANSFER,oe=u.Licensee.TYPE,Ft={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:D(e));let s=(await m.get(n,R,t,o)).data.items,c=s?.item.filter(d=>d.type===oe).map(d=>x(d));return y(c||[],s)},async create(n,e,o,t){T(o,"licensee");let i=o.serialize();e&&(i.productNumber=e);let c=(await m.post(n,R,i,t)).data.items?.item.find(d=>d.type===oe);return x(c)},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(c=>c.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 f=o.productNumber;f&&(i.productNumber=f);let v=o.licenseeProperties;Object.keys(v).forEach(b=>{i[b]=o.getLicenseeProperty(b)}),o.isForOfflineUse()&&(i.forOfflineUse=!0),o.isDryRun()&&(i.dryRun=!0);let I=o.getParameters();Object.keys(I).forEach((b,V)=>{i[`${u.ProductModule.PRODUCT_MODULE_NUMBER}${V}`]=b;let j=I[b];j&&Object.keys(j).forEach($e=>{i[$e+V]=j[$e]})})}let s=await m.post(n,`${R}/${e}/${qt}`,i,t),c=Oe(),d=s.data.ttl;return d&&c.setTtl(d),s.data.items?.item.filter(f=>f.type===u.Validation.TYPE)?.forEach(f=>{c.setValidation(P(f))}),c},transfer(n,e,o,t){p(e,"number"),p(o,"sourceLicenseeNumber");let i={sourceLicenseeNumber:o};return m.post(n,`${R}/${e}/${Yt}`,i,t)}},Ht=Ft;var q=u.License.ENDPOINT_PATH,ie=u.License.TYPE,Kt={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 L(i)},async list(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:D(e));let s=(await m.get(n,q,t,o)).data.items,c=s?.item.filter(d=>d.type===ie).map(d=>L(d));return y(c||[],s)},async create(n,e,o,t,i,s){T(i,"license");let c=i.serialize();e&&(c.licenseeNumber=e),o&&(c.licenseTemplateNumber=o),t&&(c.transactionNumber=t);let l=(await m.post(n,q,c,s)).data.items?.item.find(f=>f.type===ie);return L(l)},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(l=>l.type===ie);return L(d)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${q}/${e}`,{forceCascade:!!o},t)}},zt=Kt;var Y=u.LicenseTemplate.ENDPOINT_PATH,se=u.LicenseTemplate.TYPE,Gt={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:D(e));let s=(await m.get(n,Y,t,o)).data.items,c=s?.item.filter(d=>d.type===se).map(d=>S(d));return y(c||[],s)},async create(n,e,o,t){T(o,"licenseTemplate");let i=o.serialize();e&&(i.productModuleNumber=e);let c=(await m.post(n,Y,i,t)).data.items?.item.find(d=>d.type===se);return S(c)},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(c=>c.type===se);return S(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${Y}/${e}`,{forceCascade:!!o},t)}},Jt=Gt;var F=u.Notification.ENDPOINT_PATH,re=u.Notification.TYPE,Qt={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:D(e));let s=(await m.get(n,F,t,o)).data.items,c=s?.item.filter(d=>d.type===re).map(d=>A(d));return y(c||[],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(c=>c.type===re);return A(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${F}/${e}`,{forceCascade:!!o},t)}},Wt=Qt;var _e=u.PaymentMethod.ENDPOINT_PATH,we=u.PaymentMethod.TYPE,Xt={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:D(e));let s=(await m.get(n,_e,t,o)).data.items,c=s?.item.filter(d=>d.type===we).map(d=>$(d));return y(c||[],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(c=>c.type===we);return $(s)}},Zt=Xt;var H=u.ProductModule.ENDPOINT_PATH,ae=u.ProductModule.TYPE,en={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:D(e));let s=(await m.get(n,H,t,o)).data.items,c=s?.item.filter(d=>d.type===ae).map(d=>O(d));return y(c||[],s)},async create(n,e,o,t){T(o,"productModule");let i=o.serialize();e&&(i.productNumber=e);let c=(await m.post(n,H,i,t)).data.items?.item.find(d=>d.type===ae);return O(c)},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(c=>c.type===ae);return O(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${H}/${e}`,{forceCascade:!!o},t)}},tn=en;var K=u.Product.ENDPOINT_PATH,ce=u.Product.TYPE,nn={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:D(e));let s=(await m.get(n,K,t,o)).data.items,c=s?.item.filter(d=>d.type===ce).map(d=>M(d));return y(c||[],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(c=>c.type===ce);return M(s)},delete(n,e,o,t){return p(e,"number"),m.delete(n,`${K}/${e}`,{forceCascade:!!o},t)}},on=nn;var de=u.Token.ENDPOINT_PATH,Ue=u.Token.TYPE,sn={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:D(e));let s=(await m.get(n,de,t,o)).data.items,c=s?.item.filter(d=>d.type===Ue).map(d=>B(d));return y(c||[],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)}},rn=sn;var me=u.Transaction.ENDPOINT_PATH,ue=u.Transaction.TYPE,an={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:D(e));let s=(await m.get(n,me,t,o)).data.items,c=s?.item.filter(d=>d.type===ue).map(d=>_(d));return y(c||[],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(c=>c.type===ue);return _(s)}},cn=an;var Ve=u.Utility.ENDPOINT_PATH,dn={async listLicenseTypes(n,e){let o=`${Ve}/${u.Utility.ENDPOINT_PATH_LICENSE_TYPES}`,i=(await m.get(n,o,void 0,e)).data.items,s=u.Utility.LICENSE_TYPE,c=i?.item.filter(d=>d.type===s).map(d=>P(d).name);return y(c||[],i)},async listLicensingModels(n,e){let o=`${Ve}/${u.Utility.ENDPOINT_PATH_LICENSING_MODELS}`,i=(await m.get(n,o,void 0,e)).data.items,s=u.Utility.LICENSING_MODEL_TYPE,c=i?.item.filter(d=>d.type===s).map(d=>P(d).name);return y(c||[],i)},async listCountries(n,e,o){let t={};e&&(t[u.FILTER]=typeof e=="string"?e:D(e));let i=`${Ve}/${u.Utility.ENDPOINT_PATH_COUNTRIES}`,c=(await m.get(n,i,t,o)).data.items,d=u.Utility.COUNTRY_TYPE,l=c?.item.filter(f=>f.type===d).map(f=>ye(f));return y(l||[],c)}},mn=dn;var je=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}},un=n=>new je(n);var ke=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)}},pn=()=>new ke;export{Nt as ApiKeyRole,Pe as Bundle,Bt as BundleService,u as Constants,un as Context,ge as Country,k as License,zt as LicenseService,Ee as LicenseTemplate,Jt as LicenseTemplateService,Ce as LicenseTransactionJoin,z as LicenseType,De as Licensee,pe as LicenseeSecretMode,Ht as LicenseeService,bt as LicensingModel,h as NlicError,Rt as NodeSecretMode,ve as Notification,G as NotificationEvent,J as NotificationProtocol,Wt as NotificationService,y as Page,he as PaymentMethod,xt as PaymentMethodEnum,Zt as PaymentMethodService,Ne as Product,Ie as ProductDiscount,be as ProductModule,tn as ProductModuleService,on as ProductService,N as SecurityMode,m as Service,le as TimeVolumePeriod,Le as Token,rn as TokenService,Q as TokenType,X as Transaction,cn as TransactionService,fe as TransactionSource,W as TransactionStatus,mn as UtilityService,pn as ValidationParameters,Oe as ValidationResults,g as defineEntity,p as ensureNotEmpty,T as ensureNotNull,jt as filterDecode,D as filterEncode,ut as isDefined,te as isValid,C as itemToBundle,ye as itemToCountry,L 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,E as serialize};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|