netlicensing-client
Version:
JavaScript Wrapper for Labs64 NetLicensing RESTful API
1 lines • 237 kB
Source Map (JSON)
{"version":3,"sources":["../src/constants/LicenseeSecretMode.ts","../src/constants/LicenseType.ts","../src/constants/NotificationEvent.ts","../src/constants/NotificationProtocol.ts","../src/constants/SecurityMode.ts","../src/constants/TimeVolumePeriod.ts","../src/constants/TokenType.ts","../src/constants/TransactionSource.ts","../src/constants/TransactionStatus.ts","../src/constants/index.ts","../src/constants/ApiKeyRole.ts","../src/constants/LicensingModel.ts","../src/constants/NodeSecretMode.ts","../src/constants/PaymentMethodEnum.ts","../src/utils/cast.ts","../src/converters/itemToObject.ts","../src/utils/helpers.ts","../src/utils/serialize.ts","../src/entities/defineEntity.ts","../src/entities/Bundle.ts","../src/converters/itemToBundle.ts","../src/entities/Country.ts","../src/converters/itemToCountry.ts","../src/entities/License.ts","../src/converters/itemToLicense.ts","../src/entities/Licensee.ts","../src/converters/itemToLicensee.ts","../src/entities/LicenseTemplate.ts","../src/converters/itemToLicenseTemplate.ts","../src/entities/Notification.ts","../src/converters/itemToNotification.ts","../src/entities/PaymentMethod.ts","../src/converters/itemToPaymentMethod.ts","../src/entities/Product.ts","../src/errors/NlicError.ts","../src/entities/ProductDiscount.ts","../src/converters/itemToProduct.ts","../src/entities/ProductModule.ts","../src/converters/itemToProductModule.ts","../src/entities/Token.ts","../src/converters/itemToToken.ts","../src/entities/LicenseTransactionJoin.ts","../src/entities/Transaction.ts","../src/converters/itemToTransaction.ts","../src/services/Service/instance.ts","../package.json","../src/services/Service/toQueryString.ts","../src/services/Service/request.ts","../src/services/Service/methods.ts","../src/services/Service/index.ts","../src/utils/filter.ts","../src/utils/validation.ts","../src/vo/Page.ts","../src/services/BundleService.ts","../src/vo/ValidationResults.ts","../src/services/LicenseeService.ts","../src/services/LicenseService.ts","../src/services/LicenseTemplateService.ts","../src/services/NotificationService.ts","../src/services/PaymentMethodService.ts","../src/services/ProductModuleService.ts","../src/services/ProductService.ts","../src/services/TokenService.ts","../src/services/TransactionService.ts","../src/services/UtilityService.ts","../src/vo/Context.ts","../src/vo/ValidationParameters.ts"],"sourcesContent":["/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst LicenseeSecretMode = Object.freeze({\n // @deprecated\n DISABLED: 'DISABLED',\n PREDEFINED: 'PREDEFINED',\n CLIENT: 'CLIENT',\n});\n\nexport default LicenseeSecretMode;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst LicenseType = Object.freeze({\n FEATURE: 'FEATURE',\n TIMEVOLUME: 'TIMEVOLUME',\n FLOATING: 'FLOATING',\n QUANTITY: 'QUANTITY',\n});\n\nexport default LicenseType;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst NotificationEvent = Object.freeze({\n LICENSEE_CREATED: 'LICENSEE_CREATED',\n LICENSE_CREATED: 'LICENSE_CREATED',\n WARNING_LEVEL_CHANGED: 'WARNING_LEVEL_CHANGED',\n PAYMENT_TRANSACTION_PROCESSED: 'PAYMENT_TRANSACTION_PROCESSED',\n});\n\nexport default NotificationEvent;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst NotificationProtocol = Object.freeze({\n WEBHOOK: 'WEBHOOK',\n});\n\nexport default NotificationProtocol;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst SecurityMode = Object.freeze({\n BASIC_AUTHENTICATION: 'BASIC_AUTH',\n APIKEY_IDENTIFICATION: 'APIKEY',\n ANONYMOUS_IDENTIFICATION: 'ANONYMOUS',\n});\n\nexport default SecurityMode;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst TimeVolumePeriod = Object.freeze({\n DAY: 'DAY',\n WEEK: 'WEEK',\n MONTH: 'MONTH',\n YEAR: 'YEAR',\n});\n\nexport default TimeVolumePeriod;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst TokenType = Object.freeze({\n DEFAULT: 'DEFAULT',\n SHOP: 'SHOP',\n APIKEY: 'APIKEY',\n ACTION: 'ACTION',\n});\n\nexport default TokenType;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst TransactionSource = Object.freeze({\n SHOP: 'SHOP',\n\n AUTO_LICENSE_CREATE: 'AUTO_LICENSE_CREATE',\n AUTO_LICENSE_UPDATE: 'AUTO_LICENSE_UPDATE',\n AUTO_LICENSE_DELETE: 'AUTO_LICENSE_DELETE',\n\n AUTO_LICENSEE_CREATE: 'AUTO_LICENSEE_CREATE',\n AUTO_LICENSEE_DELETE: 'AUTO_LICENSEE_DELETE',\n AUTO_LICENSEE_VALIDATE: 'AUTO_LICENSEE_VALIDATE',\n\n AUTO_LICENSETEMPLATE_DELETE: 'AUTO_LICENSETEMPLATE_DELETE',\n\n AUTO_PRODUCTMODULE_DELETE: 'AUTO_PRODUCTMODULE_DELETE',\n\n AUTO_PRODUCT_DELETE: 'AUTO_PRODUCT_DELETE',\n\n AUTO_LICENSES_TRANSFER: 'AUTO_LICENSES_TRANSFER',\n\n SUBSCRIPTION_UPDATE: 'SUBSCRIPTION_UPDATE',\n\n RECURRING_PAYMENT: 'RECURRING_PAYMENT',\n\n CANCEL_RECURRING_PAYMENT: 'CANCEL_RECURRING_PAYMENT',\n\n OBTAIN_BUNDLE: 'OBTAIN_BUNDLE',\n});\n\nexport default TransactionSource;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst TransactionStatus = Object.freeze({\n PENDING: 'PENDING',\n CLOSED: 'CLOSED',\n CANCELLED: 'CANCELLED',\n});\n\nexport default TransactionStatus;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport LicenseeSecretMode from '@/constants/LicenseeSecretMode';\nimport LicenseType from '@/constants/LicenseType';\nimport NotificationEvent from '@/constants/NotificationEvent';\nimport NotificationProtocol from '@/constants/NotificationProtocol';\nimport SecurityMode from '@/constants/SecurityMode';\nimport TimeVolumePeriod from '@/constants/TimeVolumePeriod';\nimport TokenType from '@/constants/TokenType';\nimport TransactionSource from '@/constants/TransactionSource';\nimport TransactionStatus from '@/constants/TransactionStatus';\n\nexport default {\n LicenseeSecretMode,\n LicenseType,\n NotificationEvent,\n NotificationProtocol,\n SecurityMode,\n TimeVolumePeriod,\n TokenType,\n TransactionSource,\n TransactionStatus,\n\n // @deprecated use SecurityMode.BASIC_AUTHENTICATION instead\n BASIC_AUTHENTICATION: 'BASIC_AUTH',\n\n // @deprecated use SecurityMode.APIKEY_IDENTIFICATION instead\n APIKEY_IDENTIFICATION: 'APIKEY',\n\n // @deprecated use SecurityMode.ANONYMOUS_IDENTIFICATION instead\n ANONYMOUS_IDENTIFICATION: 'ANONYMOUS',\n\n FILTER: 'filter',\n\n Product: {\n TYPE: 'Product',\n ENDPOINT_PATH: 'product',\n },\n\n ProductModule: {\n TYPE: 'ProductModule',\n ENDPOINT_PATH: 'productmodule',\n PRODUCT_MODULE_NUMBER: 'productModuleNumber',\n },\n\n Licensee: {\n TYPE: 'Licensee',\n ENDPOINT_PATH: 'licensee',\n ENDPOINT_PATH_VALIDATE: 'validate',\n ENDPOINT_PATH_TRANSFER: 'transfer',\n LICENSEE_NUMBER: 'licenseeNumber',\n },\n\n LicenseTemplate: {\n TYPE: 'LicenseTemplate',\n ENDPOINT_PATH: 'licensetemplate',\n\n // @deprecated use LicenseType directly instead\n LicenseType,\n },\n\n License: {\n TYPE: 'License',\n ENDPOINT_PATH: 'license',\n },\n\n Validation: {\n TYPE: 'ProductModuleValidation',\n },\n\n Token: {\n TYPE: 'Token',\n ENDPOINT_PATH: 'token',\n\n // @deprecated use TokenType directly instead\n Type: TokenType,\n },\n\n PaymentMethod: {\n TYPE: 'PaymentMethod',\n ENDPOINT_PATH: 'paymentmethod',\n },\n\n Bundle: {\n TYPE: 'Bundle',\n ENDPOINT_PATH: 'bundle',\n ENDPOINT_OBTAIN_PATH: 'obtain',\n },\n\n Notification: {\n TYPE: 'Notification',\n ENDPOINT_PATH: 'notification',\n\n // @deprecated use NotificationProtocol directly instead\n Protocol: NotificationProtocol,\n\n // @deprecated use NotificationEvent directly instead\n Event: NotificationEvent,\n },\n\n Transaction: {\n TYPE: 'Transaction',\n ENDPOINT_PATH: 'transaction',\n\n // @deprecated use TransactionStatus directly instead\n Status: TransactionStatus,\n },\n\n Utility: {\n ENDPOINT_PATH: 'utility',\n ENDPOINT_PATH_LICENSE_TYPES: 'licenseTypes',\n ENDPOINT_PATH_LICENSING_MODELS: 'licensingModels',\n ENDPOINT_PATH_COUNTRIES: 'countries',\n LICENSING_MODEL_TYPE: 'LicensingModelProperties',\n LICENSE_TYPE: 'LicenseType',\n COUNTRY_TYPE: 'Country',\n },\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst ApiKeyRole = Object.freeze({\n ROLE_APIKEY_LICENSEE: 'ROLE_APIKEY_LICENSEE',\n ROLE_APIKEY_ANALYTICS: 'ROLE_APIKEY_ANALYTICS',\n ROLE_APIKEY_OPERATION: 'ROLE_APIKEY_OPERATION',\n ROLE_APIKEY_MAINTENANCE: 'ROLE_APIKEY_MAINTENANCE',\n ROLE_APIKEY_ADMIN: 'ROLE_APIKEY_ADMIN',\n});\n\nexport default ApiKeyRole;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst LicensingModel = Object.freeze({\n TRY_AND_BUY: 'TryAndBuy',\n SUBSCRIPTION: 'Subscription',\n RENTAL: 'Rental',\n FLOATING: 'Floating',\n MULTI_FEATURE: 'MultiFeature',\n PAY_PER_USE: 'PayPerUse',\n PRICING_TABLE: 'PricingTable',\n QUOTA: 'Quota',\n NODE_LOCKED: 'NodeLocked',\n DISCOUNT: 'Discount',\n});\n\nexport default LicensingModel;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst NodeSecretMode = Object.freeze({\n PREDEFINED: 'PREDEFINED',\n CLIENT: 'CLIENT',\n});\n\nexport default NodeSecretMode;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nconst PaymentMethodEnum = Object.freeze({\n NULL: 'NULL',\n PAYPAL: 'PAYPAL',\n PAYPAL_SANDBOX: 'PAYPAL_SANDBOX',\n STRIPE: 'STRIPE',\n STRIPE_TESTING: 'STRIPE_TESTING',\n});\n\nexport default PaymentMethodEnum;\n","const isBooleanString = (value: string): value is 'true' | 'false' => {\n return value === 'true' || value === 'false';\n};\n\nconst isNull = (value: string | null): value is 'null' | null => {\n return value === 'null' || value === null;\n};\n\nconst isJsonStructure = (value: string): boolean => {\n const trimmed = value.trim();\n\n return (\n (trimmed.startsWith('{') && trimmed.endsWith('}')) ||\n (trimmed.startsWith('[') && trimmed.endsWith(']'))\n );\n};\n\nconst isNumericString = (value: string): boolean => {\n const trimmed = value.trim();\n\n if (!trimmed) {\n return false;\n }\n\n const parsed = Number(trimmed);\n\n return Number.isFinite(parsed);\n};\n\nconst parseNumber = (value: string): number | string => {\n return isNumericString(value) ? Number(value) : value;\n};\n\nconst parseBoolean = (value: string): boolean | string => {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n return value;\n};\n\nconst parseNull = (value: string | null): null | string => {\n return isNull(value) ? null : value;\n};\n\nconst parseJson = (value: string): unknown => {\n if (!isJsonStructure(value)) {\n return value;\n }\n\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n};\n\nexport type CastType = 'auto' | 'string' | 'number' | 'boolean' | 'null' | 'json';\n\nconst parseAuto = (value: string): unknown => {\n if (isBooleanString(value)) {\n return value === 'true';\n }\n\n if (isNull(value)) {\n return null;\n }\n\n if (isNumericString(value)) {\n return Number(value);\n }\n\n if (isJsonStructure(value)) {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n\n return value;\n};\n\nexport const cast = (value: string | null, type: CastType = 'auto'): unknown => {\n if (value === null) {\n return null;\n }\n\n switch (type) {\n case 'string':\n return value;\n\n case 'number':\n return parseNumber(value);\n\n case 'boolean':\n return parseBoolean(value);\n\n case 'null':\n return parseNull(value);\n\n case 'json':\n return parseJson(value);\n\n case 'auto':\n default:\n return parseAuto(value);\n }\n};\n\nexport default cast;\n","import { Item, List } from '@/types/api/response';\nimport { CastType } from '@/types/utils/cast';\nimport cast from '@/utils/cast';\n\nexport type ItemToObjectCastMap = Record<string, CastType>;\n\nconst extractProperties = (properties?: { name: string; value: string }[], castMap: ItemToObjectCastMap = {}) => {\n const result: Record<string, unknown> = {};\n properties?.forEach(({ name, value }) => {\n result[name] = cast(value, castMap[name]);\n });\n return result;\n};\n\nconst extractLists = (lists?: List[], castMap: ItemToObjectCastMap = {}) => {\n const result: Record<string, unknown[]> = {};\n\n lists?.forEach((list) => {\n const { name } = list;\n result[name] = result[name] || [];\n result[name].push(itemToObject(list, castMap));\n });\n return result;\n};\n\nconst itemToObject =\n <T extends object = Record<string, unknown>>(item?: Item | List, castMap: ItemToObjectCastMap = {}): T => {\n return item\n ? ({...extractProperties(item.property, castMap), ...extractLists(item.list, castMap)} as T)\n : ({} as T);\n };\n\n\nexport default itemToObject;\n","export const has = <T extends object, K extends keyof T>(obj: T, key: K): boolean => {\n return Object.hasOwn(obj, key);\n};\n\nexport const set = <T extends object, K extends keyof T>(obj: T, key: K, value: T[K]): void => {\n obj[key] = value;\n};\n\nexport const get = <T extends object, K extends keyof T, D = undefined>(obj: T, key: K, def?: D): T[K] | D => {\n return has(obj, key) ? obj[key] : (def as D);\n};\n\nexport default {\n has,\n set,\n get,\n};\n","/**\n * Converts an object into a map of type Record<string, string>, where the value of each object property is converted\n * to a string.\n * If the property's value is `undefined`, it will be replaced with an empty string.\n * If the value is already a string, it will remain unchanged.\n * If the value is Date instance, it wll be replaced with an ISO format date string.\n * For complex types (objects, arrays, etc.), the value will be serialized into a JSON string.\n * If serialization fails, the value will be converted to a string using `String()`.\n *\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n *\n * @param obj - The object to be converted into a map.\n * @param options\n * @returns A map (Record<string, string>) with converted property values from the object.\n */\nexport default <T extends object>(obj: T, options: { ignore?: string[] } = {}): Record<string, string> => {\n const map: Record<string, string> = {};\n\n const { ignore = [] } = options;\n\n Object.entries(obj).forEach(([k, v]) => {\n // ignore keys\n if (ignore.includes(k)) {\n return;\n }\n\n if (typeof v === 'function') {\n // ignore functions\n return;\n } else if (v === undefined) {\n map[k] = ''; // if the value is `undefined`, replace it with an empty string\n } else if (typeof v === 'string') {\n map[k] = v; // If the value is already a string, leave it unchanged\n } else if (v instanceof Date) {\n // if the value is Date, convert it to ISO string\n map[k] = v.toISOString();\n } else if (typeof v !== 'object' || v === null) {\n // If it's not an object (or is null), convert it to string\n map[k] = String(v);\n } else {\n // Try to serialize the object or array into JSON\n try {\n map[k] = JSON.stringify(v);\n } catch {\n map[k] = String(v);\n }\n }\n });\n\n return map;\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n// types\nimport type {\n Entity,\n EntityMethods,\n Proto,\n PropGetEventListener,\n PropSetEventListener,\n} from '@/types/entities/defineEntity';\n\n// utils\nimport { set, has, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\nconst defineEntity = function <P extends Proto, T extends object, M extends object>(\n props: T,\n methods: M,\n proto: P = {} as P,\n options?: { set?: PropSetEventListener<T>; get?: PropGetEventListener<T> },\n) {\n const listeners: { set: PropSetEventListener<T>[]; get: PropGetEventListener<T>[] } = {\n set: [],\n get: [],\n };\n\n if (options?.get) {\n listeners.get.push(options.get);\n }\n\n if (options?.set) {\n listeners.set.push(options.set);\n }\n\n const base: EntityMethods<T> = {\n set(this: void, key, value): void {\n set(props, key, value);\n },\n\n get(this: void, key, def) {\n return get(props, key, def);\n },\n\n has(this: void, key) {\n return has(props, key);\n },\n\n // Aliases\n setProperty(key, value) {\n this.set(key, value);\n },\n\n addProperty(key, value) {\n this.set(key, value);\n },\n\n getProperty(key, def) {\n return this.get(key, def);\n },\n\n hasProperty(key) {\n return this.has(key);\n },\n\n setProperties(properties) {\n Object.entries(properties).forEach(([k, v]) => {\n this.set(k as keyof T, v as T[keyof T]);\n });\n },\n\n serialize(this: void) {\n return serialize(props);\n },\n };\n\n return new Proxy(props, {\n get(obj: T, prop: string | symbol, receiver) {\n if (Object.hasOwn(methods, prop)) {\n return methods[prop as keyof typeof methods];\n }\n\n if (Object.hasOwn(base, prop)) {\n return base[prop as keyof typeof base];\n }\n\n listeners.get.forEach((l) => {\n l(obj, prop, receiver);\n });\n\n return Reflect.get(obj, prop, receiver);\n },\n\n set(obj, prop, value, receiver) {\n listeners.set.forEach((l) => {\n l(obj, prop, value, receiver);\n });\n\n return Reflect.set(obj, prop, value, receiver);\n },\n\n getPrototypeOf() {\n return proto.prototype || null;\n },\n }) as Entity<T, M>;\n};\n\nexport default defineEntity;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n\n// types\nimport type { BundleProps, BundleMethods, BundleEntity } from '@/types/entities/Bundle';\n\n// utils\nimport { set, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\n// entity factory\nimport defineEntity from './defineEntity';\n\n/**\n * NetLicensing Bundle entity.\n *\n * Properties visible via NetLicensing API:\n *\n * Unique number that identifies the bundle. Vendor can assign this number when creating a bundle or\n * let NetLicensing generate one.\n * @property string number\n *\n * If set to false, the bundle is disabled.\n * @property boolean active\n *\n * Bundle name.\n * @property string name\n *\n * Price for the bundle. If >0, it must always be accompanied by the currency specification.\n * @property number price\n *\n * Specifies currency for the bundle price. Check data types to discover which currencies are\n * supported.\n * @property string currency\n *\n * The bundle includes a set of templates, each identified by a unique template number.\n * @property string[] licenseTemplateNumbers\n *\n * Arbitrary additional user properties of string type may be associated with each bundle. The name of user property\n * must not be equal to any of the fixed property names listed above and must be none of id, deleted.\n */\nconst Bundle = function <T extends object>(properties: BundleProps<T> = {} as BundleProps<T>): BundleEntity<T> {\n const props: BundleProps = { ...properties };\n\n const methods: BundleMethods = {\n setActive(this: void, active: boolean) {\n set(props, 'active', active);\n },\n\n getActive<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'active', def) as boolean | D;\n },\n\n setNumber(this: void, number: string) {\n set(props, 'number', number);\n },\n\n getNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'number', def) as string | D;\n },\n\n setName(this: void, name: string): void {\n set(props, 'name', name);\n },\n\n getName<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'name', def) as string | D;\n },\n\n setPrice(this: void, price: number): void {\n set(props, 'price', price);\n },\n\n getPrice<D = undefined>(this: void, def?: D): number | D {\n return get(props, 'price', def) as number | D;\n },\n\n setCurrency(this: void, currency: string): void {\n set(props, 'currency', currency);\n },\n\n getCurrency<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'currency', def) as string | D;\n },\n\n setProductNumber(number: string) {\n set(props, 'productNumber', number);\n },\n\n getProductNumber<D = undefined>(def?: D): string | D {\n return get(props, 'productNumber', def) as string | D;\n },\n\n setLicenseTemplateNumbers(this: void, numbers: string[]): void {\n set(props, 'licenseTemplateNumbers', numbers);\n },\n\n addLicenseTemplateNumber(this: void, number: string): void {\n if (!props.licenseTemplateNumbers) {\n props.licenseTemplateNumbers = [];\n }\n\n props.licenseTemplateNumbers.push(number);\n },\n\n getLicenseTemplateNumbers<D = undefined>(this: void, def?: D): string[] | D {\n return get(props, 'licenseTemplateNumbers', def) as string[] | D;\n },\n\n removeLicenseTemplateNumber(this: void, number: string): void {\n const { licenseTemplateNumbers: numbers = [] } = props;\n\n numbers.splice(numbers.indexOf(number), 1);\n props.licenseTemplateNumbers = numbers;\n },\n\n getStaleLicenseTemplateNumbers<D = undefined>(this: void, def?: D): string[] | D {\n return get(props, 'staleLicenseTemplateNumbers', def) as string[] | D;\n },\n\n serialize(this: void): Record<string, string> {\n const cast: Record<string, string> = {};\n\n if (props.licenseTemplateNumbers) {\n cast['licenseTemplateNumbers'] = props.licenseTemplateNumbers.join(',');\n }\n\n return serialize({ ...props, ...cast }, { ignore: ['staleLicenseTemplateNumbers'] });\n },\n };\n\n return defineEntity(props as BundleProps<T>, methods, Bundle);\n};\n\nexport default Bundle;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\nimport Bundle from '@/entities/Bundle';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { BundleProps } from '@/types/entities/Bundle';\n\nexport default <T extends object = BundleProps>(item?: Item) => {\n const props = itemToObject<Record<string, unknown>>(item,{\n active: 'boolean',\n number: 'string',\n name: 'string',\n price: 'number',\n currency: 'string',\n productNumber: 'string',\n licenseTemplateNumbers: 'string',\n staleLicenseTemplateNumbers: 'string',\n });\n\n const { licenseTemplateNumbers, staleLicenseTemplateNumbers } = props;\n\n if (licenseTemplateNumbers && typeof licenseTemplateNumbers === 'string') {\n props.licenseTemplateNumbers = licenseTemplateNumbers.split(',');\n }\n\n if (staleLicenseTemplateNumbers && typeof staleLicenseTemplateNumbers === 'string') {\n props.staleLicenseTemplateNumbers = staleLicenseTemplateNumbers.split(',');\n }\n\n return Bundle<T>(props as BundleProps<T>);\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n// types\nimport type { CountryProps, CountryMethods, CountryEntity } from '@/types/entities/Country';\n\n// entity factory\nimport defineEntity from './defineEntity';\n\n/**\n * Country entity used internally by NetLicensing.\n *\n * Properties visible via NetLicensing API:\n *\n * @property code - Unique code of country.\n * @property name - Unique name of country\n * @property vatPercent - Country vat.\n * @property isEu - is country in EU.\n */\nconst Country = function (properties: CountryProps = {} as CountryProps): CountryEntity {\n const defaults: CountryProps = {\n code: '',\n name: '',\n vatPercent: 0,\n isEu: false,\n };\n\n const props: CountryProps = { ...defaults, ...properties };\n\n const methods: CountryMethods = {\n getCode(this: void): string {\n return props.code;\n },\n\n getName(this: void): string {\n return props.name;\n },\n\n getVatPercent(this: void): number {\n return props.vatPercent as number;\n },\n\n getIsEu(this: void): boolean {\n return props.isEu;\n },\n };\n\n return defineEntity(props, methods, Country);\n};\n\nexport default Country;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\n\n// entities\nimport Country from '@/entities/Country';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { CountryProps } from '@/types/entities/Country';\n\nexport default (item?: Item) =>\n Country(\n itemToObject<CountryProps>(item, {\n code: 'string',\n name: 'string',\n vatPercent: 'number',\n isEu: 'boolean',\n }),\n );\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n// types\nimport { LicenseMethods, LicenseProps, LicenseEntity } from '@/types/entities/License';\n\n// utils\nimport { set, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\n// entity factory\nimport defineEntity from './defineEntity';\n\n/**\n * License entity used internally by NetLicensing.\n *\n * Properties visible via NetLicensing API:\n *\n * Unique number (across all products/licensees of a vendor) that identifies the license. Vendor can\n * assign this number when creating a license or let NetLicensing generate one. Read-only after corresponding creation\n * transaction status is set to closed.\n * @property string number\n *\n * Name for the licensed item. Set from license template on creation, if not specified explicitly.\n * @property string name\n *\n * If set to false, the license is disabled. License can be re-enabled, but as long as it is disabled,\n * the license is excluded from the validation process.\n * @property boolean active\n *\n * price for the license. If >0, it must always be accompanied by the currency specification. Read-only,\n * set from license template on creation.\n * @property number price\n *\n * specifies currency for the license price. Check data types to discover which currencies are\n * supported. Read-only, set from license template on creation.\n * @property string currency\n *\n * If set to true, this license is not shown in NetLicensing Shop as purchased license. Set from license\n * template on creation, if not specified explicitly.\n * @property boolean hidden\n *\n * The unique identifier assigned to the licensee (the entity to whom the license is issued). This number is typically\n * associated with a specific customer or organization. It is used internally to reference the licensee and cannot be\n * changed after the license is created.\n * @property string licenseeNumber\n *\n * The unique identifier for the license template from which this license was created.\n * @property string licenseTemplateNumber\n *\n * A boolean flag indicating whether the license is actively being used. If true, it means the license is currently in\n * use. If false, the license is not currently assigned or in use.\n * @property boolean inUse\n *\n * This parameter is specific to TimeVolume licenses and indicates the total volume of time (e.g., in hours, days, etc.)\n * associated with the license. This value defines the amount of time the license covers, which may affect the usage\n * period and limits associated with the license.\n * @property number timeVolume\n *\n * Also, specific to TimeVolume licenses, this field defines the period of time for the timeVolume\n * (e.g., \"DAY\", \"WEEK\", \"MONTH\", \"YEAR\"). It provides the time unit for the timeVolume value, clarifying whether the\n * time is measured in days, weeks, or any other defined period.\n * @property string timeVolumePeriod\n *\n * For TimeVolume licenses, this field indicates the start date of the license’s validity period. This date marks when\n * the license becomes active and the associated time volume starts being consumed.\n * It can be represented as a string \"now\" or a Date object.\n * @property string|Date Date startDate\n *\n * Parent(Feature) license number\n * @property string parentfeature\n *\n * Arbitrary additional user properties of string type may be associated with each license. The name of user property\n * must not be equal to any of the fixed property names listed above and must be none of id, deleted, licenseeNumber,\n * licenseTemplateNumber.\n */\nconst License = function <T extends object>(properties: LicenseProps<T> = {} as LicenseProps<T>): LicenseEntity<T> {\n const props: LicenseProps = { ...(properties as T) };\n\n const methods: LicenseMethods = {\n setActive(this: void, active: boolean): void {\n set(props, 'active', active);\n },\n\n getActive<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'active', def) as boolean | D;\n },\n\n setNumber(this: void, number: string): void {\n set(props, 'number', number);\n },\n\n getNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'number', def) as string | D;\n },\n\n setName(this: void, name: string): void {\n set(props, 'name', name);\n },\n\n getName<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'name', def) as string | D;\n },\n\n setPrice(this: void, price: number): void {\n set(props, 'price', price);\n },\n\n getPrice<D = undefined>(this: void, def?: D): number | D {\n return get(props, 'price', def) as number | D;\n },\n\n setCurrency(this: void, currency: string): void {\n set(props, 'currency', currency);\n },\n\n getCurrency<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'currency', def) as string | D;\n },\n\n setHidden(this: void, hidden: boolean): void {\n set(props, 'hidden', hidden);\n },\n\n getHidden<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'hidden', def) as boolean | D;\n },\n\n setLicenseeNumber(this: void, number: string): void {\n set(props, 'licenseeNumber', number);\n },\n\n getLicenseeNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'licenseeNumber', def) as string | D;\n },\n\n setLicenseTemplateNumber(this: void, number: string): void {\n set(props, 'licenseTemplateNumber', number);\n },\n\n getLicenseTemplateNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'licenseTemplateNumber', def) as string | D;\n },\n\n setProductModuleNumber(this: void, number: string): void {\n set(props, 'productModuleNumber', number);\n },\n\n getProductModuleNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'productModuleNumber', def) as string | D;\n },\n\n serialize(this: void): Record<string, string> {\n return serialize(props, { ignore: ['inUse'] });\n },\n };\n\n return defineEntity(props as LicenseProps<T>, methods, License);\n};\n\nexport default License;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\nimport License from '@/entities/License';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { LicenseProps } from '@/types/entities/License';\n\nexport default <T extends object = LicenseProps>(item?: Item) => {\n const props = itemToObject<Record<string, unknown>>(item, {\n active: 'boolean',\n number: 'string',\n name: 'string',\n price: 'number',\n currency: 'string',\n hidden: 'boolean',\n licenseeNumber: 'string',\n licenseTemplateNumber: 'string',\n productModuleNumber: 'string',\n startDate: 'string',\n inUse: 'boolean',\n });\n\n const { startDate } = props;\n\n if (startDate && typeof startDate === 'string') {\n props.startDate = startDate === 'now' ? startDate : new Date(startDate);\n }\n\n return License<T>(props as LicenseProps<T>);\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n\n// entity factory\nimport defineEntity from '@/entities/defineEntity';\n\n// types\nimport { LicenseeMethods, LicenseeProps, LicenseeEntity } from '@/types/entities/Licensee';\n\n// utils\nimport { set, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\n/**\n * Licensee entity used internally by NetLicensing.\n *\n * Properties visible via NetLicensing API:\n *\n * Unique number (across all products of a vendor) that identifies the licensee. Vendor can assign this\n * number when creating a licensee or let NetLicensing generate one. Read-only after creation of the first license for\n * the licensee.\n * @property string number\n *\n * Licensee name.\n * @property string name\n *\n * If set to false, the licensee is disabled. Licensee can not obtain new licenses, and validation is\n * disabled (tbd).\n * @property boolean active\n *\n * Licensee Secret for licensee deprecated use Node-Locked Licensing Model instead\n * @property string licenseeSecret\n *\n * Mark licensee for transfer.\n * @property boolean markedForTransfer\n *\n * Arbitrary additional user properties of string type may be associated with each licensee. The name of user property\n * must not be equal to any of the fixed property names listed above and must be none of id, deleted, productNumber\n */\n\nconst Licensee = function <T extends object>(properties: LicenseeProps<T> = {} as LicenseeProps<T>): LicenseeEntity<T> {\n const props: LicenseeProps = { ...properties };\n\n const methods: LicenseeMethods = {\n setActive(this: void, active: boolean): void {\n set(props, 'active', active);\n },\n\n getActive<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'active', def) as boolean | D;\n },\n\n setNumber(this: void, number: string): void {\n set(props, 'number', number);\n },\n getNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'number', def) as string | D;\n },\n\n setName(this: void, name: string): void {\n set(props, 'name', name);\n },\n\n getName<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'name', def) as string | D;\n },\n\n setProductNumber(this: void, number: string): void {\n set(props, 'productNumber', number);\n },\n\n getProductNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'productNumber', def) as string | D;\n },\n\n setMarkedForTransfer(this: void, mark: boolean): void {\n set(props, 'markedForTransfer', mark);\n },\n\n getMarkedForTransfer<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'markedForTransfer', def) as boolean | D;\n },\n\n serialize(this: void): Record<string, string> {\n return serialize(props, { ignore: ['inUse'] });\n },\n };\n\n return defineEntity(props as LicenseeProps<T>, methods, Licensee);\n};\n\nexport default Licensee;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\nimport Licensee from '@/entities/Licensee';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { LicenseeProps } from '@/types/entities/Licensee';\n\nexport default <T extends object = LicenseeProps>(item?: Item) => {\n const props = itemToObject<Record<string, unknown>>(item, {\n active: 'boolean',\n number: 'string',\n name: 'string',\n markedForTransfer: 'boolean',\n productNumber: 'string',\n inUse: 'boolean',\n });\n\n const { aliases } = props;\n\n if (aliases && typeof aliases === 'string') {\n props.aliases = aliases.split(',');\n }\n \n return Licensee<T>(props as LicenseeProps<T>);\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n// entity factory\nimport defineEntity from '@/entities/defineEntity';\n\n// types\nimport { LicenseTypeValues } from '@/types/constants/LicenseType';\nimport {\n LicenseTemplateMethods,\n LicenseTemplateProps,\n LicenseTemplateEntity,\n} from '@/types/entities/LicenseTemplate';\n\n// utils\nimport { set, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\n/**\n * License template entity used internally by NetLicensing.\n *\n * Properties visible via NetLicensing API:\n *\n * Unique number (across all products of a vendor) that identifies the license template. Vendor can\n * assign this number when creating a license template or let NetLicensing generate one.\n * Read-only after creation of the first license from this license template.\n * @property string number\n *\n * If set to false, the license template is disabled. Licensee can not obtain any new licenses off this\n * license template.\n * @property boolean active\n *\n * Name for the licensed item.\n * @property string name\n *\n * Type of licenses created from this license template. Supported types: \"FEATURE\", \"TIMEVOLUME\",\n * \"FLOATING\", \"QUANTITY\"\n * @property string licenseType\n *\n * Price for the license. If >0, it must always be accompanied by the currency specification.\n * @property number price\n *\n * Specifies currency for the license price. Check data types to discover which currencies are\n * supported.\n * @property string currency\n *\n * If set to true, every new licensee automatically gets one license out of this license template on\n * creation. Automatic licenses must have their price set to 0.\n * @property boolean automatic\n *\n * If set to true, this license template is not shown in NetLicensing Shop as offered for purchase.\n * @property boolean hidden\n *\n * If set to true, licenses from this license template are not visible to the end customer, but\n * participate in validation.\n * @property boolean hideLicenses\n *\n * If set to true, this license template defines grace period of validity granted after subscription expiration.\n * @property boolean gracePeriod\n *\n * Mandatory for 'TIMEVOLUME' license type.\n * @property number timeVolume\n *\n * Time volume period for 'TIMEVOLUME' license type. Supported types: \"DAY\", \"WEEK\", \"MONTH\", \"YEAR\"\n * @property string timeVolumePeriod\n *\n * Mandatory for 'FLOATING' license type.\n * @property number maxSessions\n *\n * Mandatory for 'QUANTITY' license type.\n * @property number quantity\n */\n\nconst LicenseTemplate = function <T extends object>(\n properties: LicenseTemplateProps<T> = {} as LicenseTemplateProps<T>,\n): LicenseTemplateEntity<T> {\n const props: LicenseTemplateProps = { ...properties };\n\n const methods: LicenseTemplateMethods = {\n setActive(this: void, active: boolean): void {\n set(props, 'active', active);\n },\n\n getActive<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'active', def) as boolean | D;\n },\n\n setNumber(this: void, number: string): void {\n set(props, 'number', number);\n },\n\n getNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'number', def) as string | D;\n },\n\n setName(this: void, name: string): void {\n set(props, 'name', name);\n },\n\n getName<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'name', def) as string | D;\n },\n\n setLicenseType(this: void, type: LicenseTypeValues): void {\n set(props, 'licenseType', type);\n },\n\n getLicenseType<D = undefined>(this: void, def?: D): LicenseTypeValues | D {\n return get(props, 'licenseType', def) as LicenseTypeValues | D;\n },\n\n setPrice(this: void, price: number): void {\n set(props, 'price', price);\n },\n\n getPrice<D = undefined>(this: void, def?: D): number | D {\n return get(props, 'price', def) as number | D;\n },\n\n setCurrency(this: void, currency: string): void {\n set(props, 'currency', currency);\n },\n\n getCurrency<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'currency', def) as string | D;\n },\n\n setAutomatic(this: void, automatic: boolean): void {\n set(props, 'automatic', automatic);\n },\n\n getAutomatic<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'automatic', def) as boolean | D;\n },\n\n setHidden(this: void, hidden: boolean): void {\n set(props, 'hidden', hidden);\n },\n\n getHidden<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'hidden', def) as boolean | D;\n },\n\n setHideLicenses(this: void, hideLicenses: boolean): void {\n set(props, 'hideLicenses', hideLicenses);\n },\n\n getHideLicenses<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'hideLicenses', def) as boolean | D;\n },\n\n setProductModuleNumber(this: void, productModuleNumber: string): void {\n set(props, 'productModuleNumber', productModuleNumber);\n },\n\n getProductModuleNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'productModuleNumber', def) as string | D;\n },\n\n serialize(this: void): Record<string, string> {\n return serialize(props, { ignore: ['inUse'] });\n },\n };\n\n return defineEntity(props as LicenseTemplateProps<T>, methods, LicenseTemplate);\n};\n\nexport default LicenseTemplate;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\nimport LicenseTemplate from '@/entities/LicenseTemplate';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { LicenseTemplateProps } from '@/types/entities/LicenseTemplate';\n\nexport default <T extends object = LicenseTemplateProps>(item?: Item) =>\n LicenseTemplate<T>(\n itemToObject<T>(item, {\n active: 'boolean',\n number: 'string',\n name: 'string',\n licenseType: 'string',\n price: 'number',\n currency: 'string',\n automatic: 'boolean',\n hidden: 'boolean',\n hideLicenses: 'boolean',\n productModuleNumber: 'string',\n inUse: 'boolean',\n }),\n );\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\n// entity factory\nimport defineEntity from '@/entities/defineEntity';\nimport { NotificationEventValues } from '@/types/constants/NotificationEvent';\nimport { NotificationProtocolValues } from '@/types/constants/NotificationProtocol';\n\n// types\nimport { NotificationMethods, NotificationProps, NotificationEntity } from '@/types/entities/Notification';\n\n// utils\nimport { set, get } from '@/utils/helpers';\nimport serialize from '@/utils/serialize';\n\n/**\n * NetLicensing Notification entity.\n *\n * Properties visible via NetLicensing API:\n *\n * Unique number that identifies the notification. Vendor can assign this number when creating a notification or\n * let NetLicensing generate one.\n * @property string number\n *\n * If set to false, the notification is disabled. The notification will not be fired when the event triggered.\n * @property boolean active\n *\n * Notification name.\n * @property string name\n *\n * Notification type. Indicate the method of transmitting notification, ex: EMAIL, WEBHOOK.\n * @property float type\n *\n * Comma separated string of events that fire the notification when emitted.\n * @property string events\n *\n * Notification response payload.\n * @property string payload\n *\n * Notification response url. Optional. Uses only for WEBHOOK type notification.\n * @property string url\n *\n * Arbitrary additional user properties of string type may be associated with each notification.\n * The name of user property must not be equal to any of the fixed property names listed above and must be none of id,\n * deleted.\n */\n\nconst Notification = function <T extends object>(\n properties: NotificationProps<T> = {} as NotificationProps<T>,\n): NotificationEntity<T> {\n const props: NotificationProps = { ...properties };\n\n const methods: NotificationMethods = {\n setActive(this: void, active: boolean): void {\n set(props, 'active', active);\n },\n\n getActive<D = undefined>(this: void, def?: D): boolean | D {\n return get(props, 'active', def) as boolean | D;\n },\n\n setNumber(this: void, number: string): void {\n set(props, 'number', number);\n },\n\n getNumber<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'number', def) as string | D;\n },\n\n setName(this: void, name: string): void {\n set(props, 'name', name);\n },\n\n getName<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'name', def) as string | D;\n },\n\n setProtocol(this: void, protocol: NotificationProtocolValues): void {\n set(props, 'protocol', protocol);\n },\n\n getProtocol<D = undefined>(this: void, def?: D): NotificationProtocolValues | D {\n return get(props, 'protocol', def) as NotificationProtocolValues | D;\n },\n\n setEvents(this: void, events: NotificationEventValues[]): void {\n set(props, 'events', events);\n },\n\n getEvents<D = undefined>(this: void, def?: D): NotificationEventValues[] | D {\n return get(props, 'events', def) as NotificationEventValues[] | D;\n },\n\n addEvent(event: NotificationEventValues): void {\n const events = this.getEvents([]) as NotificationEventValues[];\n events.push(event);\n\n this.setEvents(events);\n },\n\n setPayload(this: void, payload: string): void {\n set(props, 'payload', payload);\n },\n\n getPayload<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'payload', def) as string | D;\n },\n\n setEndpoint(this: void, endpoint: string): void {\n set(props, 'endpoint', endpoint);\n },\n\n getEndpoint<D = undefined>(this: void, def?: D): string | D {\n return get(props, 'endpoint', def) as string | D;\n },\n\n serialize(): Record<string, string> {\n const data = serialize(props);\n\n if (data.events) {\n data.events = this.getEvents([]).join(',');\n }\n\n return data;\n },\n };\n\n return defineEntity(props as NotificationProps<T>, methods, Notification);\n};\n\nexport default Notification;\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 NetLicensing\n */\nimport itemToObject from '@/converters/itemToObject';\nimport Notification from '@/entities/Notification';\n\n// types\nimport { Item } from '@/types/api/response';\nimport { NotificationProps } from '@/types/entities/Notification';\n\nexport default <T extends object = NotificationProps>(item?: Item) => {\n const props = itemToObject<Record<string, unknown>>(item, {\n active: 'boolean',\n number: 'string',\n name: 'string',\n protocol: 'string',\n events: 'string',\n payload: 'string',\n endpoint: 'string',\n });\n\n const { events } = props;\n\n if (events && typeof events === 'string') {\n props.events = events.split(',');\n }\n\n return Notification<T>(props as NotificationProps<T>);\n};\n","/**\n * @author Labs64 <netlicensing@labs64.com>\n * @license Apache-2.0\n * @link https://netlicensing.io\n * @copyright 2017 Labs64 Ne