@tonysamperi/ts-mapi-core 1.5.0 → 1.6.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/changelog.md +4 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +4 -3
- package/dist/cjs/services/http/index.cjs +1 -1
- package/dist/cjs/services/http/index.cjs.map +1 -1
- package/dist/cjs/services/http/index.d.cts +1 -0
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs +1 -1
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -1
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.d.cts +1 -0
- package/dist/cjs/services/http/smp-http.service.cjs +1 -1
- package/dist/cjs/services/http/smp-http.service.cjs.map +1 -1
- package/dist/cjs/services/index.cjs +1 -1
- package/dist/cjs/services/index.cjs.map +1 -1
- package/dist/cjs/services/index.d.cts +1 -0
- package/dist/cjs/shared/api/index.cjs +1 -1
- package/dist/cjs/shared/api/index.cjs.map +1 -1
- package/dist/cjs/shared/api/smp-error-response.class.cjs +1 -1
- package/dist/cjs/shared/api/smp-error-response.class.cjs.map +1 -1
- package/dist/cjs/shared/api/smp-error-response.class.d.cts +2 -6
- package/dist/cjs/shared/crypto/index.cjs +1 -1
- package/dist/cjs/shared/crypto/index.cjs.map +1 -1
- package/dist/cjs/shared/crypto/smp-secure-code.class.cjs +1 -1
- package/dist/cjs/shared/crypto/smp-secure-code.class.cjs.map +1 -1
- package/dist/cjs/shared/crypto/smp-secure-code.class.d.cts +5 -0
- package/dist/cjs/shared/rxjs/index.cjs +1 -1
- package/dist/cjs/shared/rxjs/index.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/index.d.cts +3 -0
- package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs +2 -0
- package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map +1 -0
- package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.d.cts +17 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +2 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +1 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +15 -0
- package/dist/cjs/shared/utils/cache/index.cjs +1 -1
- package/dist/cjs/shared/utils/cache/index.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/index.d.cts +2 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.d.cts +6 -4
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs +1 -1
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.cts +3 -2
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs +1 -1
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.d.cts +1 -0
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs +1 -1
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.d.cts +1 -0
- package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs +2 -0
- package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.d.cts +9 -0
- package/dist/cjs/shared/utils/index.cjs +1 -1
- package/dist/cjs/shared/utils/index.cjs.map +1 -1
- package/dist/cjs/shared/utils/index.d.cts +2 -0
- package/dist/cjs/shared/utils/smp-common-utils.class.cjs +1 -1
- package/dist/cjs/shared/utils/smp-common-utils.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/smp-common-utils.class.d.cts +2 -1
- package/dist/esm/chunk-3AFPQCOH.js +1 -0
- package/dist/esm/{chunk-WN7IOY62.js → chunk-3XWLMKWI.js} +1 -1
- package/dist/esm/chunk-5VCNTUI6.js +1 -0
- package/dist/esm/chunk-DTVHTARR.js +1 -0
- package/dist/esm/{chunk-CUAIWQU7.js → chunk-FAUAQNPB.js} +1 -1
- package/dist/esm/{chunk-W7XM5LDH.js → chunk-GALYBKBP.js} +1 -1
- package/dist/esm/chunk-JFKLRHIQ.js +1 -0
- package/dist/esm/{chunk-KZCXOA33.js → chunk-V2OQU7B5.js} +1 -1
- package/dist/esm/chunk-VP72PKJQ.js +1 -0
- package/dist/esm/chunk-Z7KKB4KI.js +1 -0
- package/dist/esm/index.d.ts +6 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/services/http/index.d.ts +1 -0
- package/dist/esm/services/http/index.js +1 -1
- package/dist/esm/services/http/smp-http-session-storage-cache.class.d.ts +1 -0
- package/dist/esm/services/http/smp-http-session-storage-cache.class.js +1 -1
- package/dist/esm/services/http/smp-http.service.js +1 -1
- package/dist/esm/services/index.d.ts +1 -0
- package/dist/esm/services/index.js +1 -1
- package/dist/esm/shared/api/index.js +1 -1
- package/dist/esm/shared/api/smp-error-response.class.d.ts +2 -6
- package/dist/esm/shared/api/smp-error-response.class.js +1 -1
- package/dist/esm/shared/crypto/index.js +1 -1
- package/dist/esm/shared/crypto/smp-secure-code.class.d.ts +5 -0
- package/dist/esm/shared/crypto/smp-secure-code.class.js +1 -1
- package/dist/esm/shared/rxjs/index.d.ts +3 -0
- package/dist/esm/shared/rxjs/index.js +1 -1
- package/dist/esm/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.d.ts +17 -0
- package/dist/esm/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.js +1 -0
- package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.d.ts +15 -0
- package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.js +1 -0
- package/dist/esm/shared/utils/cache/index.d.ts +2 -0
- package/dist/esm/shared/utils/cache/index.js +1 -1
- package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.d.ts +6 -4
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.ts +3 -2
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js +1 -1
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.d.ts +1 -0
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.js +1 -1
- package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.d.ts +1 -0
- package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.js +1 -1
- package/dist/esm/shared/utils/cache/smp-is-smp-cached-value.function.d.ts +9 -0
- package/dist/esm/shared/utils/cache/smp-is-smp-cached-value.function.js +1 -0
- package/dist/esm/shared/utils/index.d.ts +2 -0
- package/dist/esm/shared/utils/index.js +1 -1
- package/dist/esm/shared/utils/smp-common-utils.class.d.ts +2 -1
- package/dist/esm/shared/utils/smp-common-utils.class.js +1 -1
- package/package.json +2 -2
- package/dist/esm/chunk-KEYBWRJC.js +0 -1
- package/dist/esm/chunk-OM2B3B4I.js +0 -1
- package/dist/esm/chunk-QMTVV3AM.js +0 -1
- package/dist/esm/chunk-RZ4YI35O.js +0 -1
- /package/dist/esm/{chunk-DGUMFWCQ.js → chunk-6MJDU4CZ.js} +0 -0
- /package/dist/esm/{chunk-L6UZLRQU.js → chunk-B3OEBKFG.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var a=(n,t)=>l(n,"name",{value:t,configurable:!0});var F=(n,t)=>{for(var r in t)l(n,r,{get:t[r],enumerable:!0})},W=(n,t,r,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!L.call(n,s)&&s!==r&&l(n,s,{get:()=>t[s],enumerable:!(e=M(t,s))||e.enumerable});return n};var _=n=>W(l({},"__esModule",{value:!0}),n);var ut={};F(ut,{SmpCommonUtils:()=>d});module.exports=_(ut);var k=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function h(n){return n.match(k)}a(h,"smpAsciiWords");var w="\\ud800-\\udfff",q="\\u0300-\\u036f",H="\\ufe20-\\ufe2f",z="\\u20d0-\\u20ff",Z="\\u1ab0-\\u1aff",B="\\u1dc0-\\u1dff",J=q+H+z+Z+B,y="\\u2700-\\u27bf",E="a-z\\xdf-\\xf6\\xf8-\\xff",K="\\xac\\xb1\\xd7\\xf7",v="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",G="\\u2000-\\u206f",V=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",O="A-Z\\xc0-\\xd6\\xd8-\\xde",Q="\\ufe0e\\ufe0f",C=K+v+G+V,j="['\u2019]",m=`[${C}]`,X=`[${J}]`,S="\\d",Y=`[${y}]`,R=`[${E}]`,A=`[^${w}${C+S+y+E+O}]`,tt="\\ud83c[\\udffb-\\udfff]",rt=`(?:${X}|${tt})`,et=`[^${w}]`,N="(?:\\ud83c[\\udde6-\\uddff]){2}",I="[\\ud800-\\udbff][\\udc00-\\udfff]",f=`[${O}]`,st="\\u200d",x=`(?:${R}|${A})`,nt=`(?:${f}|${A})`,b=`(?:${j}(?:d|ll|m|re|s|t|ve))?`,g=`(?:${j}(?:D|LL|M|RE|S|T|VE))?`,T=`${rt}?`,U=`[${Q}]?`,ot=`(?:${st}(?:${[et,N,I].join("|")})${U+T})*`,it="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ct="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",at=U+T+ot,$=`(?:${[Y,N,I].join("|")})${at}`,p=class{static{a(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${f}?${R}+${b}(?=${[m,f,"$"].join("|")})`,`${nt}+${g}(?=${[m,f+x,"$"].join("|")})`,`${f}?${x}+${b}`,`${f}+${g}`,ct,it,`${S}+`,$].join("|"),"g");static RS_EMOJI=$;static unicodeWords(t){return t.match(this.RE_UNICODE_WORDS)}};var D=function(n){return n.GET="GET",n.POST="POST",n.PUT="PUT",n.DELETE="DELETE",n.PATCH="PATCH",n}({});var d=class n{static{a(this,"SmpCommonUtils")}static arrayRemove(t,r){let e=[],s=t.filter((o,i)=>r(o,i)&&e.push(i));return e.reverse().forEach(o=>t.splice(o,1)),s}static assertIsArray(t,r){if(!Array.isArray(t))throw new Error(r||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(t,r){if(!this.isBoolean(t))throw new Error(r||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(t,r){if(!this.isFunction(t))throw new Error(r||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(t,r,e){if(!(t instanceof r))throw new Error(e||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(t,r){if(this.isEmpty(t))throw new Error(r||`${this.constructor.name} => entity was empty`)}static assertIsNumber(t,r){if(typeof t!="number")throw new Error(r||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(t,r){if(!this.isNumeric(t))throw new Error(r||`${this.constructor.name} => val was not numeric`)}static assertIsObject(t,r){if(!this.isObject(t))throw new Error(r||`${this.constructor.name} => val was not an object`)}static assertIsString(t,r){if(!this.isString(t))throw new Error(r||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(t,r){if(!t)throw new Error(r||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...t){let r=t.filter(e=>!!e).join("/").replace(/(?<!:)\/\/+/g,"/");return r.startsWith("http")&&!r.endsWith("/")?`${r}/`:r}static downloadBlob(t,r){let e=window.URL.createObjectURL(t),s=document.createElement("a");s.href=e,s.setAttribute("download",r),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let r="0123456789abcdef",e="";for(let s=0;s<t;s++){let o=Math.floor(Math.random()*r.length);e+=r[o]}return e}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=Math.random()*16|0;return(t==="x"?r:r&3|8).toString(16)})}static getDecimalPrecision(t){if(this.assertIsNumeric(t),!isFinite(+t))return 0;let r=1,e=0;for(;Math.round(+t*r)/r!==t;)r*=10,e++;return e}static getType(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}static isBoolean(t){return typeof t=="boolean"}static isColor(t){if(!t||!this.isString(t))return!1;let r=new Option().style;return r.color=t,r.color!==""}static isEmpty(t){return!t&&t!==0}static isEqual(t,r){function e(){if(t.length!==r.length)return!1;for(let c=0;c<t.length;c++)if(!n.isEqual(t[c],r[c]))return!1;return!0}a(e,"areArraysEqual");function s(){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(let c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&!n.isEqual(t[c],r[c]))return!1;return!0}a(s,"areObjectsEqual");function o(){return t.toString()===r.toString()}a(o,"areFunctionsEqual");function i(){return t===r}a(i,"arePrimativesEqual");let u=this.getType(t);return u!==this.getType(r)?!1:u==="array"?e():u==="object"?s():u==="function"?o():i()}static isFormField(t){return/^(?:input|select|textarea|button)$/i.test(t.nodeName)}static isFunction(t){return typeof t==typeof isNaN}static isNotEmpty(t){return!this.isEmpty(t)}static isNumber(t){return typeof t=="number"&&this.isNumeric(t)}static isNumeric(t){return!isNaN(t)}static isObject(t){return!!t&&t===Object(t)&&t.constructor===Object}static isPrimitive(t){let r=this.getType(t);return r!=="function"&&(r!=="object"||!t)}static isString(t){return typeof t=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(t,r){if(this.assertIsFunction(r,`CommonUtils => expected type of iteratee to be Function, got ${typeof r}`),this.isObject(t))return Object.entries(t).reduce((e,[s,o])=>(e.push(r(o,s)),e),[]);if(Array.isArray(t))return t.map(r);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof r}`)}static mapObjectKeys(t,r){return Object.entries(t).reduce((e,[s,o])=>(e[s]=r.call(null,s,o),e),{})}static mapObjectValues(t,r){return this.isObject(t)?Object.entries(t).reduce((e,[s,o])=>(e[s]=r.call(null,o,s),e),{}):{}}static noop(){}static objectHasValue(t,r){return!!~Object.values(t).filter(e=>this.isEqual(e,r))}static omit(t,r){return Object.keys(t).filter(s=>!r.includes(s)).reduce((s,o)=>(s[o]=t[o],s),{})}static parseBoolean(t){return t?/^true$/i.test(t):!1}static parseJsonSafely(t){try{return JSON.parse(t)}catch(r){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:t,error:r});return}}static pick(t,r){return r.reduce((e,s)=>(s in t&&(e[s]=t[s]),e),{})}static runSafely(t,r=null,e=[]){if(this.isFunction(t))return t.apply(r,e)}static sleep(t){return new Promise(r=>setTimeout(r,t))}static sprintf(t,...r){return this.isString(t)&&r.length?this.sprintf(t.replace("%s",String(r.shift())),...r):t}static stripComments(t){return typeof t=="string"?t.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):t}static submitFakeForm({action:t,method:r=D.POST,data:e,target:s}){let o=Object.entries(e||{}).map(([u,c])=>`<input name="${u}" type="hidden" value="${c}" />`),i=document.createElement("form");i.method=r,i.action=t,i.innerHTML=`${o}`,i.target=s||"_self",document.body.append(i),i.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((r,e,s)=>(e=e.toLowerCase(),r+(s?e.charAt(0).toUpperCase()+e.slice(1):e)),"")}static toKebabCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(t){return this.toCamelCase(t).replace(/^(.)/,r=>r.toUpperCase())}static toSnakeCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(t){return this.toSnakeCase(t).toUpperCase()}static words(t,r){return r===void 0?(p.HAS_UNICODE_WORD(t)?p.unicodeWords(t):h(t))||[]:t.match(r)||[]}};0&&(module.exports={SmpCommonUtils});
|
|
2
2
|
//# sourceMappingURL=smp-common-utils.class.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/utils/smp-common-utils.class.ts","../../../../src/shared/utils/smp-ascii-words.function.ts","../../../../src/shared/utils/smp-unicode-words.class.ts","../../../../src/shared/api/smp-rest-verbs.enum.ts"],"sourcesContent":["import {smpAsciiWords} from \"./smp-ascii-words.function.js\";\nimport {SmpUnicodeWords} from \"./smp-unicode-words.class.js\";\nimport {SmpRestVerbs} from \"../api/smp-rest-verbs.enum.js\";\n\nexport class SmpCommonUtils {\n /**\n * Removes items the predicate returns truthy for from the source array and returns them\n */\n static arrayRemove<T = any>(array: T[], iteratee: (item: T, index: number) => any): T[] {\n // in order to not mutate the original array until the very end, we want to cache the indexes to remove while preparing the result to return\n const toRemove: number[] = [];\n const result = array.filter((item, index) => iteratee(item, index) && toRemove.push(index));\n // just before returning, we can then remove the items, making sure we start from the higher indexes: otherwise they would shift at each removal\n toRemove.reverse().forEach((i) => array.splice(i, 1));\n\n return result;\n }\n\n static assertIsArray<T>(entity: T[], withMessage?: string): asserts entity is T[] {\n if (!Array.isArray(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not an array\");\n }\n }\n\n static assertIsBoolean(entity: any, withMessage?: string): asserts entity is boolean {\n if (!this.isBoolean(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not boolean\");\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static assertIsFunction(entity: any, withMessage?: string): asserts entity is Function {\n if (!this.isFunction(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => entity was not a function\");\n }\n }\n\n static assertIsInstance(\n entity: any,\n klass: new (...args: any[]) => any,\n withMessage?: string\n ): asserts entity is typeof klass {\n if (!(entity instanceof klass)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not instance of class\");\n }\n }\n\n static assertIsNotEmpty(val: any, withMessage?: string): void {\n if (this.isEmpty(val)) {\n throw new Error(withMessage || \"KikCommonUtils => entity was empty\");\n }\n }\n\n static assertIsNumber(entity: any, withMessage?: string): asserts entity is number {\n if (typeof entity !== typeof 0) {\n throw new Error(withMessage || \"KikCommonUtils => val was not numeric\");\n }\n }\n\n static assertIsNumeric(entity: any, withMessage?: string): void {\n if (!this.isNumeric(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not numeric\");\n }\n }\n\n static assertIsObject(entity: any, withMessage?: string): asserts entity is object {\n if (!this.isObject(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not an object\");\n }\n }\n\n static assertIsString(entity: any, withMessage?: string): asserts entity is string {\n if (!this.isString(entity)) {\n throw new Error(withMessage || \"KikCommonUtils => val was not a string\");\n }\n }\n\n static assertIsTruthy<T>(condition: T, withMessage?: string): asserts condition {\n if (!condition) {\n throw new Error(withMessage || \"KikCommonUtils => condition wasn't truthy\");\n }\n }\n\n static buildPath(...args: any[]): string {\n const result = args\n .filter((a) => !!a)\n .join(\"/\")\n // .replace(/(?:([^:])|^)\\/\\//g, \"$1/\");\n .replace(/(?<!:)\\/\\/+/g, \"/\");\n\n return result.startsWith(\"http\") && !result.endsWith(\"/\") ? `${result}/` : result;\n }\n\n static downloadBlob(blob: Blob, filename: string): void {\n const url = window.URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.setAttribute(\"download\", filename);\n document.body.appendChild(link);\n link.click();\n }\n\n static generateRandomHexString(length: number = 12): string {\n const chars = \"0123456789abcdef\";\n let hexString = \"\";\n\n for (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length);\n hexString += chars[randomIndex];\n }\n\n return hexString;\n }\n\n static generateUUID(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n\n return v.toString(16);\n });\n }\n\n static getDecimalPrecision(val: number | string): number {\n this.assertIsNumeric(val);\n if (!isFinite(+val)) {\n return 0;\n }\n let factor = 1,\n precision = 0;\n while (Math.round(+val * factor) / factor !== val) {\n factor *= 10;\n precision++;\n }\n return precision;\n }\n\n /**\n * More accurately check the type of JavaScript object\n * @param {Object} entity The object\n * @return {String} The object type\n */\n static getType(entity: any): string {\n return Object.prototype.toString.call(entity).slice(8, -1).toLowerCase();\n }\n\n static isBoolean(value: any): value is boolean {\n return typeof value === typeof !0;\n }\n\n /**\n * Returns true if string is a valid CSS color\n * @param str\n */\n static isColor(str: string): boolean {\n if (!str || !this.isString(str)) {\n return !1;\n }\n const s = new Option().style;\n s.color = str;\n\n return s.color !== \"\";\n }\n\n static isEmpty(entity: any): boolean {\n return !entity && entity !== 0;\n }\n\n /**\n *\n * @param value1 {any} first term of comparison\n * @param value2 {any} second term of comparison\n *\n * @returns boolean\n */\n static isEqual(value1: any, value2: any): boolean {\n function areArraysEqual() {\n // Check length\n if (value1.length !== value2.length) {\n return false;\n }\n // Check each item in the array\n for (let i = 0; i < value1.length; i++) {\n if (!SmpCommonUtils.isEqual(value1[i], value2[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n function areObjectsEqual() {\n if (Object.keys(value1).length !== Object.keys(value2).length) {\n return false;\n }\n\n // Check each item in the object\n for (const key in value1) {\n if (Object.prototype.hasOwnProperty.call(value1, key)) {\n if (!SmpCommonUtils.isEqual(value1[key], value2[key])) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n function areFunctionsEqual() {\n return value1.toString() === value2.toString();\n }\n\n function arePrimativesEqual() {\n return value1 === value2;\n }\n\n // Get the object type\n const type = this.getType(value1);\n\n // If the two items are not the same type, return false\n if (type !== this.getType(value2)) {\n return false;\n }\n\n // Compare based on type\n if (type === \"array\") {\n return areArraysEqual();\n }\n if (type === \"object\") {\n return areObjectsEqual();\n }\n if (type === \"function\") {\n return areFunctionsEqual();\n }\n return arePrimativesEqual();\n }\n\n static isFormField(el: HTMLElement): boolean {\n return /^(?:input|select|textarea|button)$/i.test(el.nodeName);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static isFunction(entity: any): entity is Function {\n return typeof entity === typeof isNaN;\n }\n\n static isNotEmpty(entity: any): boolean {\n return !this.isEmpty(entity);\n }\n\n /**\n * Returns true if the entity is a number\n * @param entity\n */\n static isNumber(entity: any): entity is number {\n return typeof entity === typeof 0 && this.isNumeric(entity);\n }\n\n /**\n * Returns true whether you're dealing with a numeric entity. Use isNumber if you want exact type check\n * @param entity\n */\n static isNumeric(entity: any): boolean {\n return !isNaN(entity);\n }\n\n static isObject(entity: any): entity is object {\n return !!entity && entity === Object(entity) && entity.constructor === Object;\n }\n\n /**\n * This one is from underscore.js 1.13.6\n * It basically checks if a value is generically an object (meaning Array, Date, Map).\n * If you want a strict check use KikCommonUtils.isObject instead.\n * [TS] TODO: It would be nice to exclude String, Number, Boolean and Symbol, but for now, this will do\n * @param entity\n * @returns {boolean}\n */\n static isPrimitive(entity: any): boolean {\n const type = this.getType(entity);\n return type !== \"function\" && (type !== \"object\" || !entity);\n\n // Possible solution => Object.prototype.toString.call(val)\n // This always returns [Object myType], so we could compare with a list of primitive types: [\"number\", \"string\", \"symbol\", \"ecc..\"]\n }\n\n static isString(entity: any): entity is string {\n return typeof entity === typeof \"\";\n }\n\n static isWindows(): boolean {\n return navigator.userAgent.toLowerCase().includes(\"win\");\n }\n\n /**\n *\n * @param objLike object or array\n * @param iteratee the map fn\n */\n static mapObject<T = any>(objLike: any, iteratee: (v: any, indexOrKey: string | number, arr?: string[]) => any): T[] {\n this.assertIsFunction(iteratee, `CommonUtils => expected type of iteratee to be Function, got ${typeof iteratee}`);\n if (this.isObject(objLike)) {\n return Object.entries(objLike).reduce((acc: T[], [key, value]) => {\n acc.push(iteratee(value, key));\n\n return acc;\n }, []);\n }\n if (Array.isArray(objLike)) {\n return objLike.map(iteratee);\n }\n throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof iteratee}`);\n }\n\n static mapObjectKeys<T extends string = string>(\n obj: Record<T, any>,\n callback: (key: string, value: any) => any\n ): Record<string, any> {\n return Object.entries(obj).reduce((acc: Record<string, any>, [key, value]) => {\n acc[key] = callback.call(null, key, value);\n\n return acc;\n }, {});\n }\n\n static mapObjectValues<T extends string = string>(\n obj: Partial<Record<T, any>>,\n callback: (value: any, key: string) => any\n ): Record<string, any> {\n if (!this.isObject(obj)) {\n return {};\n }\n\n return Object.entries(obj).reduce((acc: Record<string, any>, [key, value]) => {\n acc[key] = callback.call(null, value, key);\n\n return acc;\n }, {});\n }\n\n static noop() {\n }\n\n static objectHasValue<T extends object>(obj: T, value: any): boolean {\n return !!~Object.values(obj).filter((v) => this.isEqual(v, value));\n }\n\n static parseBoolean(str?: string): boolean {\n return str ? /^true$/i.test(str) : !1;\n }\n\n static parseJsonSafely<T = any>(str: string): T | void {\n try {\n return JSON.parse(str);\n }\n catch (e) {\n console.warn(\"KikCommonUtils => couldn't parse json string\", {\n str,\n error: e\n });\n\n return void 0;\n }\n }\n\n static pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n return keys.reduce((acc, key) => {\n if (key in obj) {\n acc[key] = obj[key];\n }\n return acc;\n }, {} as Pick<T, K>);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static runSafely<V = any, U = any, T extends Function = (...args: V[]) => U>(\n fn?: T,\n thisArg = null,\n params: V[] = []\n ): U | void {\n if (this.isFunction(fn)) {\n return fn.apply(thisArg, params);\n }\n }\n\n static sleep(timeToDelay: number) {\n return new Promise((resolve) => setTimeout(resolve, timeToDelay));\n }\n\n static sprintf(str: string, ...argv: (string | number | symbol)[]): string {\n if (!this.isString(str)) {\n return str;\n }\n\n return !argv.length ? str : this.sprintf(str.replace(\"%s\", String(argv.shift())), ...argv);\n }\n\n static stripComments(html: string): string {\n return typeof html === typeof \"\" ? html.replace(/(<!--.*?-->)|(<!--[\\S\\s]+?-->)|(<!--[\\S\\s]*?$)/g, \"\") : html;\n }\n\n static submitFakeForm<T extends object = object>({\n action,\n method = SmpRestVerbs.POST,\n data,\n target\n }: {\n action: string;\n method: SmpRestVerbs;\n data?: T;\n target?: \"_blank\" | \"_self\"\n }): void {\n const fieldInputs = Object.entries(data || {}).map(([k, v]) => `<input name=\"${k}\" type=\"hidden\" value=\"${v}\" />`);\n const form = document.createElement(\"form\");\n form.method = method;\n form.action = action;\n form.innerHTML = `${fieldInputs}`;\n form.target = target || \"_self\";\n document.body.append(form);\n form.submit();\n }\n\n\n static toCamelCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).reduce((res, word, index) => {\n word = word.toLowerCase();\n return (\n res + (index ? word.charAt(0).toUpperCase() + word.slice(1) : word)\n );\n }, \"\");\n }\n\n static toKebabCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).join(\"-\").toLowerCase();\n }\n\n static toPascalCase(s: string): string {\n return this.toCamelCase(s).replace(/^(.)/, ($1) => {\n return $1.toUpperCase();\n });\n }\n\n static toSnakeCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).join(\"_\").toLowerCase();\n }\n\n static toUpperSnakeCase(s: string): string {\n return this.toSnakeCase(s).toUpperCase();\n }\n\n static words(string: string, pattern?: RegExp): string[] {\n if (pattern === void 0) {\n const result = SmpUnicodeWords.HAS_UNICODE_WORD(string) ? SmpUnicodeWords.unicodeWords(string) : smpAsciiWords(string);\n return result || [];\n }\n return string.match(pattern) || [];\n }\n\n}\n","/** Used to match words composed of alphanumeric characters. */\n// eslint-disable-next-line no-control-regex\nconst reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\nexport function smpAsciiWords(string: string): string[] | null {\n return string.match(reAsciiWord);\n}\n","/** Used to compose Unicode character classes. */\nconst rsAstralRange = \"\\\\ud800-\\\\udfff\";\nconst rsComboMarksRange = \"\\\\u0300-\\\\u036f\";\nconst reComboHalfMarksRange = \"\\\\ufe20-\\\\ufe2f\";\nconst rsComboSymbolsRange = \"\\\\u20d0-\\\\u20ff\";\nconst rsComboMarksExtendedRange = \"\\\\u1ab0-\\\\u1aff\";\nconst rsComboMarksSupplementRange = \"\\\\u1dc0-\\\\u1dff\";\nconst rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange;\nconst rsDingbatRange = \"\\\\u2700-\\\\u27bf\";\nconst rsLowerRange = \"a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff\";\nconst rsMathOpRange = \"\\\\xac\\\\xb1\\\\xd7\\\\xf7\";\nconst rsNonCharRange = \"\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf\";\nconst rsPunctuationRange = \"\\\\u2000-\\\\u206f\";\nconst rsSpaceRange = \" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000\";\nconst rsUpperRange = \"A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde\";\nconst rsVarRange = \"\\\\ufe0e\\\\ufe0f\";\nconst rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nconst rsApos = \"['\\u2019]\";\nconst rsBreak = `[${rsBreakRange}]`;\nconst rsCombo = `[${rsComboRange}]`;\nconst rsDigit = \"\\\\d\";\nconst rsDingbat = `[${rsDingbatRange}]`;\nconst rsLower = `[${rsLowerRange}]`;\nconst rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigit + rsDingbatRange + rsLowerRange + rsUpperRange}]`;\nconst rsFitz = \"\\\\ud83c[\\\\udffb-\\\\udfff]\";\nconst rsModifier = `(?:${rsCombo}|${rsFitz})`;\nconst rsNonAstral = `[^${rsAstralRange}]`;\nconst rsRegional = \"(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}\";\nconst rsSurrPair = \"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\";\nconst rsUpper = `[${rsUpperRange}]`;\nconst rsZWJ = \"\\\\u200d\";\n\n/** Used to compose unicode regexes. */\nconst rsMiscLower = `(?:${rsLower}|${rsMisc})`;\nconst rsMiscUpper = `(?:${rsUpper}|${rsMisc})`;\nconst rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?`;\nconst rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?`;\nconst reOptMod = `${rsModifier}?`;\nconst rsOptVar = `[${rsVarRange}]?`;\nconst rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join(\"|\")})${rsOptVar + reOptMod})*`;\nconst rsOrdLower = \"\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])\";\nconst rsOrdUpper = \"\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])\";\nconst rsSeq = rsOptVar + reOptMod + rsOptJoin;\nconst rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join(\"|\")})${rsSeq}`;\n\nexport class SmpUnicodeWords {\n static readonly HAS_UNICODE_WORD = RegExp.prototype.test.bind(\n /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/\n );\n\n static readonly RE_UNICODE_WORDS = RegExp([\n `${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, \"$\"].join(\"|\")})`,\n `${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, \"$\"].join(\"|\")})`,\n `${rsUpper}?${rsMiscLower}+${rsOptContrLower}`,\n `${rsUpper}+${rsOptContrUpper}`,\n rsOrdUpper,\n rsOrdLower,\n `${rsDigit}+`,\n rsEmoji\n ].join(\"|\"), \"g\");\n\n static readonly RS_EMOJI = rsEmoji;\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param string {string} string: the string to inspect.\n * @returns {Array<string>} Returns the words of `string`.\n */\n static unicodeWords(string: string): string[] | null {\n return string.match(this.RE_UNICODE_WORDS);\n }\n}\n","export enum SmpRestVerbs {\n GET = \"GET\",\n POST = \"POST\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n PATCH = \"PATCH\"\n}\n"],"mappings":"4dAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,IAAA,eAAAC,EAAAH,ICEA,IAAMI,EAAc,4CAEb,SAASC,EAAcC,EAAc,CACxC,OAAOA,EAAOC,MAAMH,CAAAA,CACxB,CAFgBC,EAAAA,EAAAA,iBCHhB,IAAMG,EAAgB,kBAChBC,EAAoB,kBACpBC,EAAwB,kBACxBC,EAAsB,kBACtBC,EAA4B,kBAC5BC,EAA8B,kBAC9BC,EAAeL,EAAoBC,EAAwBC,EAAsBC,EAA4BC,EAC7GE,EAAiB,kBACjBC,EAAe,4BACfC,EAAgB,uBAChBC,EAAiB,+CACjBC,EAAqB,kBACrBC,EAAe,+JACfC,EAAe,4BACfC,EAAa,iBACbC,EAAeN,EAAgBC,EAAiBC,EAAqBC,EAGrEI,EAAS,YACTC,EA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CommonJS","reAsciiWord","smpAsciiWords","string","match","rsAstralRange","rsComboMarksRange","reComboHalfMarksRange","rsComboSymbolsRange","rsComboMarksExtendedRange","rsComboMarksSupplementRange","rsComboRange","rsDingbatRange","rsLowerRange","rsMathOpRange","rsNonCharRange","rsPunctuationRange","rsSpaceRange","rsUpperRange","rsVarRange","rsBreakRange","rsApos","rsBreak","rsCombo","rsDigit","rsDingbat","rsLower","rsMisc","rsFitz","rsModifier","rsNonAstral","rsRegional","rsSurrPair","rsUpper","rsZWJ","rsMiscLower","rsMiscUpper","rsOptContrLower","rsOptContrUpper","reOptMod","rsOptVar","rsOptJoin","join","rsOrdLower","rsOrdUpper","rsSeq","rsEmoji","SmpUnicodeWords","HAS_UNICODE_WORD","RegExp","prototype","test","bind","RE_UNICODE_WORDS","RS_EMOJI","unicodeWords","string","match","SmpRestVerbs","SmpCommonUtils","arrayRemove","array","iteratee","toRemove","result","filter","item","index","push","reverse","forEach","i","splice","assertIsArray","entity","withMessage","Array","isArray","Error","assertIsBoolean","isBoolean","assertIsFunction","isFunction","assertIsInstance","klass","assertIsNotEmpty","val","isEmpty","assertIsNumber","assertIsNumeric","isNumeric","assertIsObject","isObject","assertIsString","isString","assertIsTruthy","condition","buildPath","args","a","join","replace","startsWith","endsWith","downloadBlob","blob","filename","url","window","URL","createObjectURL","link","document","createElement","href","setAttribute","body","appendChild","click","generateRandomHexString","length","chars","hexString","randomIndex","Math","floor","random","generateUUID","c","r","toString","getDecimalPrecision","isFinite","factor","precision","round","getType","Object","prototype","call","slice","toLowerCase","value","isColor","str","s","Option","style","color","isEqual","value1","value2","areArraysEqual","areObjectsEqual","keys","key","hasOwnProperty","areFunctionsEqual","arePrimativesEqual","type","isFormField","el","test","nodeName","isNaN","isNotEmpty","isNumber","constructor","isPrimitive","isWindows","navigator","userAgent","includes","mapObject","objLike","entries","reduce","acc","map","mapObjectKeys","obj","callback","mapObjectValues","noop","objectHasValue","values","v","parseBoolean","parseJsonSafely","JSON","parse","e","console","warn","error","pick","runSafely","fn","thisArg","params","apply","sleep","timeToDelay","Promise","resolve","setTimeout","sprintf","argv","String","shift","stripComments","html","submitFakeForm","action","method","SmpRestVerbs","POST","data","target","fieldInputs","k","form","innerHTML","append","submit","toCamelCase","words","res","word","charAt","toUpperCase","toKebabCase","toPascalCase","$1","toSnakeCase","toUpperSnakeCase","string","pattern","SmpUnicodeWords","HAS_UNICODE_WORD","unicodeWords","smpAsciiWords","match"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/utils/smp-common-utils.class.ts","../../../../src/shared/utils/smp-ascii-words.function.ts","../../../../src/shared/utils/smp-unicode-words.class.ts","../../../../src/shared/api/smp-rest-verbs.enum.ts"],"sourcesContent":["import {smpAsciiWords} from \"./smp-ascii-words.function.js\";\nimport {SmpUnicodeWords} from \"./smp-unicode-words.class.js\";\nimport {SmpRestVerbs} from \"../api/smp-rest-verbs.enum.js\";\n\nexport class SmpCommonUtils {\n /**\n * Removes items the predicate returns truthy for from the source array and returns them\n */\n static arrayRemove<T = any>(array: T[], iteratee: (item: T, index: number) => any): T[] {\n // in order to not mutate the original array until the very end, we want to cache the indexes to remove while preparing the result to return\n const toRemove: number[] = [];\n const result = array.filter((item, index) => iteratee(item, index) && toRemove.push(index));\n // just before returning, we can then remove the items, making sure we start from the higher indexes: otherwise they would shift at each removal\n toRemove.reverse().forEach((i) => array.splice(i, 1));\n\n return result;\n }\n\n static assertIsArray<T>(entity: T[], withMessage?: string): asserts entity is T[] {\n if (!Array.isArray(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not an array`);\n }\n }\n\n static assertIsBoolean(entity: any, withMessage?: string): asserts entity is boolean {\n if (!this.isBoolean(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not boolean`);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static assertIsFunction(entity: any, withMessage?: string): asserts entity is Function {\n if (!this.isFunction(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => entity was not a function`);\n }\n }\n\n static assertIsInstance(\n entity: any,\n klass: new (...args: any[]) => any,\n withMessage?: string\n ): asserts entity is typeof klass {\n if (!(entity instanceof klass)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not instance of class`);\n }\n }\n\n static assertIsNotEmpty(val: any, withMessage?: string): void {\n if (this.isEmpty(val)) {\n throw new Error(withMessage || `${this.constructor.name} => entity was empty`);\n }\n }\n\n static assertIsNumber(entity: any, withMessage?: string): asserts entity is number {\n if (typeof entity !== typeof 0) {\n throw new Error(withMessage || `${this.constructor.name} => val was not numeric`);\n }\n }\n\n static assertIsNumeric(entity: any, withMessage?: string): void {\n if (!this.isNumeric(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not numeric`);\n }\n }\n\n static assertIsObject(entity: any, withMessage?: string): asserts entity is object {\n if (!this.isObject(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not an object`);\n }\n }\n\n static assertIsString(entity: any, withMessage?: string): asserts entity is string {\n if (!this.isString(entity)) {\n throw new Error(withMessage || `${this.constructor.name} => val was not a string`);\n }\n }\n\n static assertIsTruthy<T>(condition: T, withMessage?: string): asserts condition {\n if (!condition) {\n throw new Error(withMessage || `${this.constructor.name} => condition wasn't truthy`);\n }\n }\n\n static buildPath(...args: any[]): string {\n const result = args\n .filter((a) => !!a)\n .join(\"/\")\n // .replace(/(?:([^:])|^)\\/\\//g, \"$1/\");\n .replace(/(?<!:)\\/\\/+/g, \"/\");\n\n return result.startsWith(\"http\") && !result.endsWith(\"/\") ? `${result}/` : result;\n }\n\n static downloadBlob(blob: Blob, filename: string): void {\n const url = window.URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.setAttribute(\"download\", filename);\n document.body.appendChild(link);\n link.click();\n }\n\n static generateRandomHexString(length: number = 12): string {\n const chars = \"0123456789abcdef\";\n let hexString = \"\";\n\n for (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length);\n hexString += chars[randomIndex];\n }\n\n return hexString;\n }\n\n static generateUUID(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n\n return v.toString(16);\n });\n }\n\n static getDecimalPrecision(val: number | string): number {\n this.assertIsNumeric(val);\n if (!isFinite(+val)) {\n return 0;\n }\n let factor = 1,\n precision = 0;\n while (Math.round(+val * factor) / factor !== val) {\n factor *= 10;\n precision++;\n }\n return precision;\n }\n\n /**\n * More accurately check the type of JavaScript object\n * @param {Object} entity The object\n * @return {String} The object type\n */\n static getType(entity: any): string {\n return Object.prototype.toString.call(entity).slice(8, -1).toLowerCase();\n }\n\n static isBoolean(value: any): value is boolean {\n return typeof value === typeof !0;\n }\n\n /**\n * Returns true if string is a valid CSS color\n * @param str\n */\n static isColor(str: string): boolean {\n if (!str || !this.isString(str)) {\n return !1;\n }\n const s = new Option().style;\n s.color = str;\n\n return s.color !== \"\";\n }\n\n static isEmpty(entity: any): boolean {\n return !entity && entity !== 0;\n }\n\n /**\n *\n * @param value1 {any} first term of comparison\n * @param value2 {any} second term of comparison\n *\n * @returns boolean\n */\n static isEqual(value1: any, value2: any): boolean {\n function areArraysEqual() {\n // Check length\n if (value1.length !== value2.length) {\n return false;\n }\n // Check each item in the array\n for (let i = 0; i < value1.length; i++) {\n if (!SmpCommonUtils.isEqual(value1[i], value2[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n function areObjectsEqual() {\n if (Object.keys(value1).length !== Object.keys(value2).length) {\n return false;\n }\n\n // Check each item in the object\n for (const key in value1) {\n if (Object.prototype.hasOwnProperty.call(value1, key)) {\n if (!SmpCommonUtils.isEqual(value1[key], value2[key])) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n function areFunctionsEqual() {\n return value1.toString() === value2.toString();\n }\n\n function arePrimativesEqual() {\n return value1 === value2;\n }\n\n // Get the object type\n const type = this.getType(value1);\n\n // If the two items are not the same type, return false\n if (type !== this.getType(value2)) {\n return false;\n }\n\n // Compare based on type\n if (type === \"array\") {\n return areArraysEqual();\n }\n if (type === \"object\") {\n return areObjectsEqual();\n }\n if (type === \"function\") {\n return areFunctionsEqual();\n }\n return arePrimativesEqual();\n }\n\n static isFormField(el: HTMLElement): boolean {\n return /^(?:input|select|textarea|button)$/i.test(el.nodeName);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static isFunction(entity: any): entity is Function {\n return typeof entity === typeof isNaN;\n }\n\n static isNotEmpty(entity: any): boolean {\n return !this.isEmpty(entity);\n }\n\n /**\n * Returns true if the entity is a number\n * @param entity\n */\n static isNumber(entity: any): entity is number {\n return typeof entity === typeof 0 && this.isNumeric(entity);\n }\n\n /**\n * Returns true whether you're dealing with a numeric entity. Use isNumber if you want exact type check\n * @param entity\n */\n static isNumeric(entity: any): boolean {\n return !isNaN(entity);\n }\n\n static isObject(entity: any): entity is object {\n return !!entity && entity === Object(entity) && entity.constructor === Object;\n }\n\n /**\n * This one is from underscore.js 1.13.6\n * It basically checks if a value is generically an object (meaning Array, Date, Map).\n * If you want a strict check use SmpCommonUtils.isObject instead.\n * [TS] TODO: It would be nice to exclude String, Number, Boolean and Symbol, but for now, this will do\n * @param entity\n * @returns {boolean}\n */\n static isPrimitive(entity: any): boolean {\n const type = this.getType(entity);\n return type !== \"function\" && (type !== \"object\" || !entity);\n\n // Possible solution => Object.prototype.toString.call(val)\n // This always returns [Object myType], so we could compare with a list of primitive types: [\"number\", \"string\", \"symbol\", \"ecc..\"]\n }\n\n static isString(entity: any): entity is string {\n return typeof entity === typeof \"\";\n }\n\n static isWindows(): boolean {\n return navigator.userAgent.toLowerCase().includes(\"win\");\n }\n\n /**\n *\n * @param objLike object or array\n * @param iteratee the map fn\n */\n static mapObject<T = any>(objLike: any, iteratee: (v: any, indexOrKey: string | number, arr?: string[]) => any): T[] {\n this.assertIsFunction(iteratee, `CommonUtils => expected type of iteratee to be Function, got ${typeof iteratee}`);\n if (this.isObject(objLike)) {\n return Object.entries(objLike).reduce((acc: T[], [key, value]) => {\n acc.push(iteratee(value, key));\n\n return acc;\n }, []);\n }\n if (Array.isArray(objLike)) {\n return objLike.map(iteratee);\n }\n throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof iteratee}`);\n }\n\n static mapObjectKeys<T extends string = string>(\n obj: Record<T, any>,\n callback: (key: string, value: any) => any\n ): Record<string, any> {\n return Object.entries(obj).reduce((acc: Record<string, any>, [key, value]) => {\n acc[key] = callback.call(null, key, value);\n\n return acc;\n }, {});\n }\n\n static mapObjectValues<T extends string = string>(\n obj: Partial<Record<T, any>>,\n callback: (value: any, key: string) => any\n ): Record<string, any> {\n if (!this.isObject(obj)) {\n return {};\n }\n\n return Object.entries(obj).reduce((acc: Record<string, any>, [key, value]) => {\n acc[key] = callback.call(null, value, key);\n\n return acc;\n }, {});\n }\n\n static noop() {\n }\n\n static objectHasValue<T extends object>(obj: T, value: any): boolean {\n return !!~Object.values(obj).filter((v) => this.isEqual(v, value));\n }\n\n static omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const leftKeys = (Object.keys(obj) as (keyof T)[])\n .filter((key): key is Exclude<keyof T, K> => !keys.includes(key as K));\n\n return leftKeys.reduce((acc, key) => {\n acc[key] = obj[key];\n return acc;\n }, {} as Omit<T, K>);\n }\n\n static parseBoolean(str?: string): boolean {\n return str ? /^true$/i.test(str) : !1;\n }\n\n static parseJsonSafely<T = any>(str: string): T | void {\n try {\n return JSON.parse(str);\n }\n catch (e) {\n console.warn(`${this.constructor.name} => couldn't parse json string`, {\n str,\n error: e\n });\n\n return void 0;\n }\n }\n\n static pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n return keys.reduce((acc, key) => {\n if (key in obj) {\n acc[key] = obj[key];\n }\n return acc;\n }, {} as Pick<T, K>);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n static runSafely<V = any, U = any, T extends Function = (...args: V[]) => U>(\n fn?: T,\n thisArg = null,\n params: V[] = []\n ): U | void {\n if (this.isFunction(fn)) {\n return fn.apply(thisArg, params);\n }\n }\n\n static sleep(timeToDelay: number) {\n return new Promise((resolve) => setTimeout(resolve, timeToDelay));\n }\n\n static sprintf(str: string, ...argv: (string | number | symbol)[]): string {\n if (!this.isString(str)) {\n return str;\n }\n\n return !argv.length ? str : this.sprintf(str.replace(\"%s\", String(argv.shift())), ...argv);\n }\n\n static stripComments(html: string): string {\n return typeof html === typeof \"\" ? html.replace(/(<!--.*?-->)|(<!--[\\S\\s]+?-->)|(<!--[\\S\\s]*?$)/g, \"\") : html;\n }\n\n static submitFakeForm<T extends object = object>({\n action,\n method = SmpRestVerbs.POST,\n data,\n target\n }: {\n action: string;\n method: SmpRestVerbs;\n data?: T;\n target?: \"_blank\" | \"_self\"\n }): void {\n const fieldInputs = Object.entries(data || {}).map(([k, v]) => `<input name=\"${k}\" type=\"hidden\" value=\"${v}\" />`);\n const form = document.createElement(\"form\");\n form.method = method;\n form.action = action;\n form.innerHTML = `${fieldInputs}`;\n form.target = target || \"_self\";\n document.body.append(form);\n form.submit();\n }\n\n static toCamelCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).reduce((res, word, index) => {\n word = word.toLowerCase();\n return (\n res + (index ? word.charAt(0).toUpperCase() + word.slice(1) : word)\n );\n }, \"\");\n }\n\n static toKebabCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).join(\"-\").toLowerCase();\n }\n\n static toPascalCase(s: string): string {\n return this.toCamelCase(s).replace(/^(.)/, ($1) => {\n return $1.toUpperCase();\n });\n }\n\n static toSnakeCase(s: string): string {\n return this.words(s.replace(/['\\u2019]/g, \"\")).join(\"_\").toLowerCase();\n }\n\n static toUpperSnakeCase(s: string): string {\n return this.toSnakeCase(s).toUpperCase();\n }\n\n static words(string: string, pattern?: RegExp): string[] {\n if (pattern === void 0) {\n const result = SmpUnicodeWords.HAS_UNICODE_WORD(string) ? SmpUnicodeWords.unicodeWords(string) : smpAsciiWords(string);\n return result || [];\n }\n return string.match(pattern) || [];\n }\n\n}\n","/** Used to match words composed of alphanumeric characters. */\n// eslint-disable-next-line no-control-regex\nconst reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\nexport function smpAsciiWords(string: string): string[] | null {\n return string.match(reAsciiWord);\n}\n","/** Used to compose Unicode character classes. */\nconst rsAstralRange = \"\\\\ud800-\\\\udfff\";\nconst rsComboMarksRange = \"\\\\u0300-\\\\u036f\";\nconst reComboHalfMarksRange = \"\\\\ufe20-\\\\ufe2f\";\nconst rsComboSymbolsRange = \"\\\\u20d0-\\\\u20ff\";\nconst rsComboMarksExtendedRange = \"\\\\u1ab0-\\\\u1aff\";\nconst rsComboMarksSupplementRange = \"\\\\u1dc0-\\\\u1dff\";\nconst rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange;\nconst rsDingbatRange = \"\\\\u2700-\\\\u27bf\";\nconst rsLowerRange = \"a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff\";\nconst rsMathOpRange = \"\\\\xac\\\\xb1\\\\xd7\\\\xf7\";\nconst rsNonCharRange = \"\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf\";\nconst rsPunctuationRange = \"\\\\u2000-\\\\u206f\";\nconst rsSpaceRange = \" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000\";\nconst rsUpperRange = \"A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde\";\nconst rsVarRange = \"\\\\ufe0e\\\\ufe0f\";\nconst rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nconst rsApos = \"['\\u2019]\";\nconst rsBreak = `[${rsBreakRange}]`;\nconst rsCombo = `[${rsComboRange}]`;\nconst rsDigit = \"\\\\d\";\nconst rsDingbat = `[${rsDingbatRange}]`;\nconst rsLower = `[${rsLowerRange}]`;\nconst rsMisc = `[^${rsAstralRange}${rsBreakRange + rsDigit + rsDingbatRange + rsLowerRange + rsUpperRange}]`;\nconst rsFitz = \"\\\\ud83c[\\\\udffb-\\\\udfff]\";\nconst rsModifier = `(?:${rsCombo}|${rsFitz})`;\nconst rsNonAstral = `[^${rsAstralRange}]`;\nconst rsRegional = \"(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}\";\nconst rsSurrPair = \"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\";\nconst rsUpper = `[${rsUpperRange}]`;\nconst rsZWJ = \"\\\\u200d\";\n\n/** Used to compose unicode regexes. */\nconst rsMiscLower = `(?:${rsLower}|${rsMisc})`;\nconst rsMiscUpper = `(?:${rsUpper}|${rsMisc})`;\nconst rsOptContrLower = `(?:${rsApos}(?:d|ll|m|re|s|t|ve))?`;\nconst rsOptContrUpper = `(?:${rsApos}(?:D|LL|M|RE|S|T|VE))?`;\nconst reOptMod = `${rsModifier}?`;\nconst rsOptVar = `[${rsVarRange}]?`;\nconst rsOptJoin = `(?:${rsZWJ}(?:${[rsNonAstral, rsRegional, rsSurrPair].join(\"|\")})${rsOptVar + reOptMod})*`;\nconst rsOrdLower = \"\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])\";\nconst rsOrdUpper = \"\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])\";\nconst rsSeq = rsOptVar + reOptMod + rsOptJoin;\nconst rsEmoji = `(?:${[rsDingbat, rsRegional, rsSurrPair].join(\"|\")})${rsSeq}`;\n\nexport class SmpUnicodeWords {\n static readonly HAS_UNICODE_WORD = RegExp.prototype.test.bind(\n /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/\n );\n\n static readonly RE_UNICODE_WORDS = RegExp([\n `${rsUpper}?${rsLower}+${rsOptContrLower}(?=${[rsBreak, rsUpper, \"$\"].join(\"|\")})`,\n `${rsMiscUpper}+${rsOptContrUpper}(?=${[rsBreak, rsUpper + rsMiscLower, \"$\"].join(\"|\")})`,\n `${rsUpper}?${rsMiscLower}+${rsOptContrLower}`,\n `${rsUpper}+${rsOptContrUpper}`,\n rsOrdUpper,\n rsOrdLower,\n `${rsDigit}+`,\n rsEmoji\n ].join(\"|\"), \"g\");\n\n static readonly RS_EMOJI = rsEmoji;\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param string {string} string: the string to inspect.\n * @returns {Array<string>} Returns the words of `string`.\n */\n static unicodeWords(string: string): string[] | null {\n return string.match(this.RE_UNICODE_WORDS);\n }\n}\n","export enum SmpRestVerbs {\n GET = \"GET\",\n POST = \"POST\",\n PUT = \"PUT\",\n DELETE = \"DELETE\",\n PATCH = \"PATCH\"\n}\n"],"mappings":"4dAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,IAAA,eAAAC,EAAAH,ICEA,IAAMI,EAAc,4CAEb,SAASC,EAAcC,EAAc,CACxC,OAAOA,EAAOC,MAAMH,CAAAA,CACxB,CAFgBC,EAAAA,EAAAA,iBCHhB,IAAMG,EAAgB,kBAChBC,EAAoB,kBACpBC,EAAwB,kBACxBC,EAAsB,kBACtBC,EAA4B,kBAC5BC,EAA8B,kBAC9BC,EAAeL,EAAoBC,EAAwBC,EAAsBC,EAA4BC,EAC7GE,EAAiB,kBACjBC,EAAe,4BACfC,EAAgB,uBAChBC,EAAiB,+CACjBC,EAAqB,kBACrBC,EAAe,+JACfC,EAAe,4BACfC,EAAa,iBACbC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YAAW,CACxE,CAEA,OAAO2F,aAAavF,EAAmB,CACnC,OAAO,KAAKgF,YAAYhF,CAAAA,EAAG5C,QAAQ,OAASoI,GACjCA,EAAGH,YAAW,CACzB,CACJ,CAEA,OAAOI,YAAYzF,EAAmB,CAClC,OAAO,KAAKiF,MAAMjF,EAAE5C,QAAQ,aAAc,EAAA,CAAA,EAAKD,KAAK,GAAA,EAAKyC,YAAW,CACxE,CAEA,OAAO8F,iBAAiB1F,EAAmB,CACvC,OAAO,KAAKyF,YAAYzF,CAAAA,EAAGqF,YAAW,CAC1C,CAEA,OAAOJ,MAAMU,EAAgBC,EAA4B,CACrD,OAAIA,IAAY,QACGC,EAAgBC,iBAAiBH,CAAAA,EAAUE,EAAgBE,aAAaJ,CAAAA,EAAUK,EAAcL,CAAAA,IAC9F,CAAA,EAEdA,EAAOM,MAAML,CAAAA,GAAY,CAAA,CACpC,CAEJ","names":["smp_common_utils_class_exports","__export","SmpCommonUtils","__toCommonJS","reAsciiWord","smpAsciiWords","string","match","rsAstralRange","rsComboMarksRange","reComboHalfMarksRange","rsComboSymbolsRange","rsComboMarksExtendedRange","rsComboMarksSupplementRange","rsComboRange","rsDingbatRange","rsLowerRange","rsMathOpRange","rsNonCharRange","rsPunctuationRange","rsSpaceRange","rsUpperRange","rsVarRange","rsBreakRange","rsApos","rsBreak","rsCombo","rsDigit","rsDingbat","rsLower","rsMisc","rsFitz","rsModifier","rsNonAstral","rsRegional","rsSurrPair","rsUpper","rsZWJ","rsMiscLower","rsMiscUpper","rsOptContrLower","rsOptContrUpper","reOptMod","rsOptVar","rsOptJoin","join","rsOrdLower","rsOrdUpper","rsSeq","rsEmoji","SmpUnicodeWords","HAS_UNICODE_WORD","RegExp","prototype","test","bind","RE_UNICODE_WORDS","RS_EMOJI","unicodeWords","string","match","SmpRestVerbs","SmpCommonUtils","arrayRemove","array","iteratee","toRemove","result","filter","item","index","push","reverse","forEach","i","splice","assertIsArray","entity","withMessage","Array","isArray","Error","constructor","name","assertIsBoolean","isBoolean","assertIsFunction","isFunction","assertIsInstance","klass","assertIsNotEmpty","val","isEmpty","assertIsNumber","assertIsNumeric","isNumeric","assertIsObject","isObject","assertIsString","isString","assertIsTruthy","condition","buildPath","args","a","join","replace","startsWith","endsWith","downloadBlob","blob","filename","url","window","URL","createObjectURL","link","document","createElement","href","setAttribute","body","appendChild","click","generateRandomHexString","length","chars","hexString","randomIndex","Math","floor","random","generateUUID","c","r","toString","getDecimalPrecision","isFinite","factor","precision","round","getType","Object","prototype","call","slice","toLowerCase","value","isColor","str","s","Option","style","color","isEqual","value1","value2","areArraysEqual","areObjectsEqual","keys","key","hasOwnProperty","areFunctionsEqual","arePrimativesEqual","type","isFormField","el","test","nodeName","isNaN","isNotEmpty","isNumber","isPrimitive","isWindows","navigator","userAgent","includes","mapObject","objLike","entries","reduce","acc","map","mapObjectKeys","obj","callback","mapObjectValues","noop","objectHasValue","values","v","omit","parseBoolean","parseJsonSafely","JSON","parse","e","console","warn","error","pick","runSafely","fn","thisArg","params","apply","sleep","timeToDelay","Promise","resolve","setTimeout","sprintf","argv","String","shift","stripComments","html","submitFakeForm","action","method","SmpRestVerbs","POST","data","target","fieldInputs","k","form","innerHTML","append","submit","toCamelCase","words","res","word","charAt","toUpperCase","toKebabCase","toPascalCase","$1","toSnakeCase","toUpperSnakeCase","string","pattern","SmpUnicodeWords","HAS_UNICODE_WORD","unicodeWords","smpAsciiWords","match"]}
|
|
@@ -58,7 +58,7 @@ declare class SmpCommonUtils {
|
|
|
58
58
|
/**
|
|
59
59
|
* This one is from underscore.js 1.13.6
|
|
60
60
|
* It basically checks if a value is generically an object (meaning Array, Date, Map).
|
|
61
|
-
* If you want a strict check use
|
|
61
|
+
* If you want a strict check use SmpCommonUtils.isObject instead.
|
|
62
62
|
* [TS] TODO: It would be nice to exclude String, Number, Boolean and Symbol, but for now, this will do
|
|
63
63
|
* @param entity
|
|
64
64
|
* @returns {boolean}
|
|
@@ -76,6 +76,7 @@ declare class SmpCommonUtils {
|
|
|
76
76
|
static mapObjectValues<T extends string = string>(obj: Partial<Record<T, any>>, callback: (value: any, key: string) => any): Record<string, any>;
|
|
77
77
|
static noop(): void;
|
|
78
78
|
static objectHasValue<T extends object>(obj: T, value: any): boolean;
|
|
79
|
+
static omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
79
80
|
static parseBoolean(str?: string): boolean;
|
|
80
81
|
static parseJsonSafely<T = any>(str: string): T | void;
|
|
81
82
|
static pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-5VCNTUI6.js";import{a}from"./chunk-DADFHUII.js";import{a as s}from"./chunk-EI7MMDWY.js";import{DateTime as o}from"ts-luxon";var m=class extends a{static{s(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let r=this._readRaw(e);if(this._isSmpCachedValue(r)){if(r.expiry>=o.now().ts)return r.value;this._removeRaw(e);return}return r}remove(e){this._removeRaw(e)}write(e,r,i){if(isNaN(+i)||+i<=0){this._writeRaw(e,r,i);return}let p=o.now().ts+i*1e3,u={value:r,expiry:p};this._writeRaw(e,u,i)}_isSmpCachedValue(e){return t(e)}};export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-FAUAQNPB.js";import{a as u}from"./chunk-Z7KKB4KI.js";import{a as h}from"./chunk-V2OQU7B5.js";import{a as n}from"./chunk-EI7MMDWY.js";var _=class{static{n(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new h:new o;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=u;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core";static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(a=>this._preprocessResponse(e,a)).then(a=>{if(a.ok){if(a.status===204||a.headers.get("content-length")==="0")return null;switch(t.responseType){case"blob":return a.blob();case"arraybuffer":return a.arrayBuffer();case"text":return a.text();case"json":default:return a.json()}}return a.json().then(s=>{let c=s;try{c=this._errorClass.fromPlain(s)}catch(i){console.debug("http: failed to parse error response into ErrorResponse",i)}return Promise.reject({status:a.status,message:a.statusText,body:c})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(e,t){let r=e.startsWith("http");if(t){let a=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),s=Object.fromEntries(a.searchParams.entries());a.search=new URLSearchParams({...s,...Object.fromEntries(Object.entries(t).map(([c,i])=>[c,`${i}`]))}).toString(),e=r?a.href:a.pathname+a.search}return e}static _cacheKey(e){return`${this._config.cachePrefix}${e}`}static _cachePop(e){let t=this._cacheRead(e);return this._cacheRemove(e),t}static _cacheRead(e){return this._cacheStrategy.read(this._cacheKey(e))}static _cacheRemove(e){this._cacheStrategy.remove(this._cacheKey(e))}static _cacheWrite(e,t){this._cacheStrategy.write(this._cacheKey(e),t)}static async _preprocessRequest(e){return e}static async _preprocessResponse(e,t){return t}};export{_ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-EI7MMDWY.js";function p(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}n(p,"smpIsSmpCachedValue");export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u}from"./chunk-DOKJQH4K.js";import{a as f}from"./chunk-R6VG4656.js";import{a as p}from"./chunk-4NS456EU.js";import{a as c}from"./chunk-EI7MMDWY.js";var h=class l{static{c(this,"SmpCommonUtils")}static arrayRemove(t,r){let e=[],s=t.filter((n,i)=>r(n,i)&&e.push(i));return e.reverse().forEach(n=>t.splice(n,1)),s}static assertIsArray(t,r){if(!Array.isArray(t))throw new Error(r||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(t,r){if(!this.isBoolean(t))throw new Error(r||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(t,r){if(!this.isFunction(t))throw new Error(r||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(t,r,e){if(!(t instanceof r))throw new Error(e||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(t,r){if(this.isEmpty(t))throw new Error(r||`${this.constructor.name} => entity was empty`)}static assertIsNumber(t,r){if(typeof t!="number")throw new Error(r||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(t,r){if(!this.isNumeric(t))throw new Error(r||`${this.constructor.name} => val was not numeric`)}static assertIsObject(t,r){if(!this.isObject(t))throw new Error(r||`${this.constructor.name} => val was not an object`)}static assertIsString(t,r){if(!this.isString(t))throw new Error(r||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(t,r){if(!t)throw new Error(r||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...t){let r=t.filter(e=>!!e).join("/").replace(/(?<!:)\/\/+/g,"/");return r.startsWith("http")&&!r.endsWith("/")?`${r}/`:r}static downloadBlob(t,r){let e=window.URL.createObjectURL(t),s=document.createElement("a");s.href=e,s.setAttribute("download",r),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let r="0123456789abcdef",e="";for(let s=0;s<t;s++){let n=Math.floor(Math.random()*r.length);e+=r[n]}return e}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=Math.random()*16|0;return(t==="x"?r:r&3|8).toString(16)})}static getDecimalPrecision(t){if(this.assertIsNumeric(t),!isFinite(+t))return 0;let r=1,e=0;for(;Math.round(+t*r)/r!==t;)r*=10,e++;return e}static getType(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}static isBoolean(t){return typeof t=="boolean"}static isColor(t){if(!t||!this.isString(t))return!1;let r=new Option().style;return r.color=t,r.color!==""}static isEmpty(t){return!t&&t!==0}static isEqual(t,r){function e(){if(t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(!l.isEqual(t[o],r[o]))return!1;return!0}c(e,"areArraysEqual");function s(){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&!l.isEqual(t[o],r[o]))return!1;return!0}c(s,"areObjectsEqual");function n(){return t.toString()===r.toString()}c(n,"areFunctionsEqual");function i(){return t===r}c(i,"arePrimativesEqual");let a=this.getType(t);return a!==this.getType(r)?!1:a==="array"?e():a==="object"?s():a==="function"?n():i()}static isFormField(t){return/^(?:input|select|textarea|button)$/i.test(t.nodeName)}static isFunction(t){return typeof t==typeof isNaN}static isNotEmpty(t){return!this.isEmpty(t)}static isNumber(t){return typeof t=="number"&&this.isNumeric(t)}static isNumeric(t){return!isNaN(t)}static isObject(t){return!!t&&t===Object(t)&&t.constructor===Object}static isPrimitive(t){let r=this.getType(t);return r!=="function"&&(r!=="object"||!t)}static isString(t){return typeof t=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(t,r){if(this.assertIsFunction(r,`CommonUtils => expected type of iteratee to be Function, got ${typeof r}`),this.isObject(t))return Object.entries(t).reduce((e,[s,n])=>(e.push(r(n,s)),e),[]);if(Array.isArray(t))return t.map(r);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof r}`)}static mapObjectKeys(t,r){return Object.entries(t).reduce((e,[s,n])=>(e[s]=r.call(null,s,n),e),{})}static mapObjectValues(t,r){return this.isObject(t)?Object.entries(t).reduce((e,[s,n])=>(e[s]=r.call(null,n,s),e),{}):{}}static noop(){}static objectHasValue(t,r){return!!~Object.values(t).filter(e=>this.isEqual(e,r))}static omit(t,r){return Object.keys(t).filter(s=>!r.includes(s)).reduce((s,n)=>(s[n]=t[n],s),{})}static parseBoolean(t){return t?/^true$/i.test(t):!1}static parseJsonSafely(t){try{return JSON.parse(t)}catch(r){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:t,error:r});return}}static pick(t,r){return r.reduce((e,s)=>(s in t&&(e[s]=t[s]),e),{})}static runSafely(t,r=null,e=[]){if(this.isFunction(t))return t.apply(r,e)}static sleep(t){return new Promise(r=>setTimeout(r,t))}static sprintf(t,...r){return this.isString(t)&&r.length?this.sprintf(t.replace("%s",String(r.shift())),...r):t}static stripComments(t){return typeof t=="string"?t.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):t}static submitFakeForm({action:t,method:r=p.POST,data:e,target:s}){let n=Object.entries(e||{}).map(([a,o])=>`<input name="${a}" type="hidden" value="${o}" />`),i=document.createElement("form");i.method=r,i.action=t,i.innerHTML=`${n}`,i.target=s||"_self",document.body.append(i),i.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((r,e,s)=>(e=e.toLowerCase(),r+(s?e.charAt(0).toUpperCase()+e.slice(1):e)),"")}static toKebabCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(t){return this.toCamelCase(t).replace(/^(.)/,r=>r.toUpperCase())}static toSnakeCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(t){return this.toSnakeCase(t).toUpperCase()}static words(t,r){return r===void 0?(u.HAS_UNICODE_WORD(t)?u.unicodeWords(t):f(t))||[]:t.match(r)||[]}};export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-3AFPQCOH.js";import{a as e}from"./chunk-EI7MMDWY.js";var a=class extends s{static{e(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(t){return this._staticSelf._storage.get(t)}_removeRaw(t){this._staticSelf._storage.delete(t)}_writeRaw(t,r){this._staticSelf._storage.set(t,r)}};export{a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-3AFPQCOH.js";import{a as s}from"./chunk-EI7MMDWY.js";var o=class extends i{static{s(this,"SmpBrowserCache")}_storage;_prefix;constructor(t,e){super(),this._storage=t,this._prefix=e}_flushRaw(){let t=[],e=-1;for(;++e<this._storage.length;){let r=this._storage.key(e);r&&r.startsWith(this._prefix)&&t.push(r)}for(e=-1;++e<t.length;)this._storage.removeItem(t[e])}_readRaw(t){let e=this._storage.getItem(this._prefix+t);try{return e?JSON.parse(e):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+t}`);return}}_removeRaw(t){this._storage.removeItem(this._prefix+t)}_writeRaw(t,e){try{this._storage.setItem(this._prefix+t,JSON.stringify(e))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+t}`,r)}}};export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-5VCNTUI6.js";import{a as t}from"./chunk-DADFHUII.js";import{a as s}from"./chunk-EI7MMDWY.js";import{map as u}from"rxjs";import{DateTime as m}from"ts-luxon";var p=class extends t{static{s(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(r){return this._readRaw(r).pipe(u(e=>{if(this._isSmpCachedValue(e)){if(e.expiry>=m.now().ts)return e.value;this._removeRaw(r).subscribe();return}return e}))}remove(r){return this._removeRaw(r)}write(r,e,i){if(isNaN(+i)||+i<=0)return this._writeRaw(r,e,i);let n=m.now().ts+i*1e3,o={value:e,expiry:n};return this._writeRaw(r,o,i)}_isSmpCachedValue(r){return a(r)}};export{p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-GALYBKBP.js";import{a as r}from"./chunk-EI7MMDWY.js";var e=class extends s{static{r(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as c,d as h}from"./chunk-XZEYUIQ6.js";import{a as r}from"./chunk-Z7KKB4KI.js";import{a as o}from"./chunk-Z5KZUWJJ.js";import{a as s}from"./chunk-EI7MMDWY.js";var n=class{static{s(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength;_seed;constructor(e){this._baseCode=e,this._crcLength=5,this._seed="changeme"}static check(e,t){if(new this(e).secureCode!==t)throw r.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:o.BadRequest})}_encode(){let e=new h;return e.update(c.parse(this._seed+this._baseCode)),e.finalize().toString(a).substring(0,this._crcLength).toUpperCase()}};export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"./chunk-YYOHQHR4.js";import{a as u}from"./chunk-S3E7FKAY.js";import{a}from"./chunk-EI7MMDWY.js";import{Expose as d,plainToInstance as E}from"class-transformer";function l(r,e,t,s){var n=arguments.length,o=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,s);else for(var c=r.length-1;c>=0;c--)(p=r[c])&&(o=(n<3?p(o):n>3?p(e,t,o):p(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}a(l,"_ts_decorate");function m(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}a(m,"_ts_metadata");var i=class r extends f{static{a(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new u("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=r.DEFAULT_MESSAGES,t="GENERIC_ERROR",s=500,n){super(e,n),this._errorCode=t,this._status=s,this._timestamp=Date.now()}static create({messages:e=r.DEFAULT_MESSAGES,...t}={}){return new r(u.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=E(_,e,{excludePrefixes:["_"]}),s=new r;return Object.getOwnPropertyNames(t).forEach(n=>{n in s&&(s[n]=t[n])}),s}};l([d(),m("design:type",Object),m("design:paramtypes",[])],i.prototype,"errorCode",null);l([d(),m("design:type",Number),m("design:paramtypes",[])],i.prototype,"timestamp",null);var _=class extends i{static{a(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};export{i as a};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { SmpGiftcardTransactionPlain } from './shared/giftcard/smp-giftcard-tran
|
|
|
27
27
|
export { KikMarketingCloudValidationResponse, KikMarketingCloudValidationResponseKo, KikMarketingCloudValidationResponseOk } from './shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.js';
|
|
28
28
|
export { SmpMarketingCloudValidators } from './shared/marketing-cloud/smp-marketing-cloud-validators.enum.js';
|
|
29
29
|
export { SmpFirebaseErrors } from './shared/firebase/smp-firebase-errors.enum.js';
|
|
30
|
+
export { SmpAbstractRxjsTtlCacheStrategy } from './shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.js';
|
|
30
31
|
export { smpRxjsCatchOnly } from './shared/rxjs/smp-rxjs-catch-only.function.js';
|
|
31
32
|
export { smpRxjsThrowIfEmpty } from './shared/rxjs/smp-rxjs-throw-if-empty.function.js';
|
|
32
33
|
export { smpRxjsThrowOnCondition } from './shared/rxjs/smp-rxjs-throw-on-condition.function.js';
|
|
@@ -41,20 +42,21 @@ export { SmpCachedValue } from './shared/utils/cache/smp-cached-value.interface.
|
|
|
41
42
|
export { SmpAbstractCacheStrategy } from './shared/utils/cache/smp-abstract-cache-strategy.class.js';
|
|
42
43
|
export { SmpAbstractTtlCacheStrategy } from './shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
43
44
|
export { SmpInMemoryCache } from './shared/utils/cache/smp-in-memory-cache.class.js';
|
|
45
|
+
export { smpIsSmpCachedValue } from './shared/utils/cache/smp-is-smp-cached-value.function.js';
|
|
44
46
|
export { SmpZodDateTime, smpZodDateTime } from './shared/zod/smp-zod-date-time.definition.js';
|
|
47
|
+
export { SmpDynamoService } from './services/smp-dynamo.service.js';
|
|
45
48
|
export { SmpFirebaseService } from './services/firebase/smp-firebase.service.js';
|
|
46
49
|
export { SmpFirebaseServiceConfig } from './services/firebase/smp-firebase-service-config.interface.js';
|
|
47
|
-
export { SmpDynamoService } from './services/smp-dynamo.service.js';
|
|
48
50
|
import './services/http/smp-dynamic-fetch-return.type.js';
|
|
49
51
|
import './smp-logger-methods.class-F7p-lMeQ.js';
|
|
50
52
|
import 'ts-luxon';
|
|
51
53
|
import 'rxjs';
|
|
52
54
|
import 'zod';
|
|
53
|
-
import 'firebase/app';
|
|
54
|
-
import 'firebase/auth';
|
|
55
55
|
import '@aws-sdk/util-dynamodb';
|
|
56
56
|
import '@aws-sdk/client-dynamodb';
|
|
57
|
+
import 'firebase/app';
|
|
58
|
+
import 'firebase/auth';
|
|
57
59
|
|
|
58
|
-
declare const VERSION: "1.
|
|
60
|
+
declare const VERSION: "1.6.0";
|
|
59
61
|
|
|
60
62
|
export { VERSION };
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-O7TJDNO6.js";import{a as
|
|
1
|
+
import"./chunk-O7TJDNO6.js";import{a as u,b as w}from"./chunk-QPKVVZUA.js";import"./chunk-T3P4NVTG.js";import"./chunk-B3OEBKFG.js";import"./chunk-EB55SS67.js";import"./chunk-FE4YONC4.js";import{a as j}from"./chunk-DTVHTARR.js";import"./chunk-DOKJQH4K.js";import"./chunk-R6VG4656.js";import{a as k}from"./chunk-4UTF5FWK.js";import"./chunk-NIN4PUZX.js";import{a as q}from"./chunk-RGLXAD7B.js";import{a as l}from"./chunk-MMNEY2JK.js";import"./chunk-Q77KUWBZ.js";import"./chunk-553CS7VH.js";import{a as N}from"./chunk-JF4ZPHEK.js";import"./chunk-6MJDU4CZ.js";import{a as h}from"./chunk-QWZP25QT.js";import{a as d}from"./chunk-QW43DOPY.js";import{a as U}from"./chunk-JFKLRHIQ.js";import{a as g}from"./chunk-FLTR4ZY6.js";import"./chunk-D66G2KIE.js";import"./chunk-HOM5S5W3.js";import"./chunk-ZYPNYJVE.js";import"./chunk-BHFFGFHY.js";import{a as L}from"./chunk-VPL2IMUA.js";import{a as F}from"./chunk-U4GEYICC.js";import{a as E}from"./chunk-5XYURNIE.js";import"./chunk-NQICKEAS.js";import{a as b}from"./chunk-S7DRNW2X.js";import{a as y}from"./chunk-RJBWCWAE.js";import{a as B}from"./chunk-VP72PKJQ.js";import"./chunk-XZEYUIQ6.js";import"./chunk-EHABREBA.js";import"./chunk-4LYXZUNL.js";import"./chunk-ELQKTQ6W.js";import"./chunk-U5DBFRKV.js";import"./chunk-AV6X4R7W.js";import{a as D}from"./chunk-2YYH6VGI.js";import"./chunk-SXISZIFJ.js";import{a as I}from"./chunk-4NS456EU.js";import{a as v}from"./chunk-MD2DPFLF.js";import"./chunk-NHNK7NE2.js";import"./chunk-YFGB7SCJ.js";import{a as o}from"./chunk-7MD4IY4X.js";import{a as O}from"./chunk-LB7RIIRT.js";import{a as R}from"./chunk-WLD2KYV4.js";import{a as V}from"./chunk-4A2VEL4I.js";import{a as r}from"./chunk-W462XDMF.js";import"./chunk-RCI7NEJO.js";import{a as s}from"./chunk-ZNC4KYAS.js";import"./chunk-SDQLEPBS.js";import{a}from"./chunk-3XWLMKWI.js";import{a as f}from"./chunk-FAUAQNPB.js";import{a as i}from"./chunk-Z7KKB4KI.js";import{a as c}from"./chunk-YYOHQHR4.js";import{a as _}from"./chunk-S3E7FKAY.js";import{a as S}from"./chunk-QECKVXF4.js";import"./chunk-WTEJYEK2.js";import{a as x}from"./chunk-V2OQU7B5.js";import{a as t}from"./chunk-GALYBKBP.js";import{a as p}from"./chunk-3AFPQCOH.js";import{a as m}from"./chunk-5VCNTUI6.js";import{a as e}from"./chunk-DADFHUII.js";import{a as n}from"./chunk-Z5KZUWJJ.js";import"./chunk-EI7MMDWY.js";var z="1.6.0";export{D as SMP_HEALTHZ,e as SmpAbstractCacheStrategy,U as SmpAbstractRxjsTtlCacheStrategy,p as SmpAbstractTtlCacheStrategy,b as SmpAesCrypt,v as SmpApiCommonUtils,t as SmpBrowserCache,j as SmpCommonUtils,y as SmpCrypto,r as SmpDynamoService,i as SmpErrorResponse,k as SmpFilterException,O as SmpFirebaseErrors,o as SmpFirebaseService,c as SmpGenericResponse,L as SmpGiftcardTransaction,F as SmpGiftcardTransactionHashStrategies,E as SmpGiftcardTransactionOps,a as SmpHttpService,x as SmpHttpSessionStorageCache,n as SmpHttpStatusCodes,f as SmpInMemoryCache,N as SmpMarketingCloudValidators,q as SmpRegularExpressions,_ as SmpResponseMessage,S as SmpResponseMessageTypes,I as SmpRestVerbs,B as SmpSecureCode,l as SmpSid,R as SmpSocialSignInKeys,V as SmpSocialSignInUxModes,u as SmpZodDateTime,z as VERSION,m as smpIsSmpCachedValue,s as smpNoop,d as smpRxjsCatchOnly,g as smpRxjsThrowIfEmpty,h as smpRxjsThrowOnCondition,w as smpZodDateTime};
|
|
@@ -8,5 +8,6 @@ import '../../shared/common/smp-generic-constructor.type.js';
|
|
|
8
8
|
import '../../shared/utils/cache/smp-browser-cache.class.js';
|
|
9
9
|
import '../../shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
10
10
|
import '../../shared/utils/cache/smp-abstract-cache-strategy.class.js';
|
|
11
|
+
import 'rxjs';
|
|
11
12
|
import '../../shared/utils/cache/smp-cached-value.interface.js';
|
|
12
13
|
import '../../shared/api/smp-rest-verbs.enum.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-SDQLEPBS.js";import{a as b}from"../../chunk-
|
|
1
|
+
import"../../chunk-SDQLEPBS.js";import{a as b}from"../../chunk-3XWLMKWI.js";import"../../chunk-FAUAQNPB.js";import"../../chunk-Z7KKB4KI.js";import"../../chunk-YYOHQHR4.js";import"../../chunk-S3E7FKAY.js";import"../../chunk-QECKVXF4.js";import"../../chunk-WTEJYEK2.js";import{a}from"../../chunk-V2OQU7B5.js";import"../../chunk-GALYBKBP.js";import"../../chunk-3AFPQCOH.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import{a as c}from"../../chunk-Z5KZUWJJ.js";import"../../chunk-EI7MMDWY.js";export{b as SmpHttpService,a as SmpHttpSessionStorageCache,c as SmpHttpStatusCodes};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SmpBrowserCache } from '../../shared/utils/cache/smp-browser-cache.class.js';
|
|
2
2
|
import '../../shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
3
3
|
import '../../shared/utils/cache/smp-abstract-cache-strategy.class.js';
|
|
4
|
+
import 'rxjs';
|
|
4
5
|
import '../../shared/utils/cache/smp-cached-value.interface.js';
|
|
5
6
|
|
|
6
7
|
declare class SmpHttpSessionStorageCache extends SmpBrowserCache {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-V2OQU7B5.js";import"../../chunk-GALYBKBP.js";import"../../chunk-3AFPQCOH.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpHttpSessionStorageCache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-3XWLMKWI.js";import"../../chunk-FAUAQNPB.js";import"../../chunk-Z7KKB4KI.js";import"../../chunk-YYOHQHR4.js";import"../../chunk-S3E7FKAY.js";import"../../chunk-QECKVXF4.js";import"../../chunk-V2OQU7B5.js";import"../../chunk-GALYBKBP.js";import"../../chunk-3AFPQCOH.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpHttpService};
|
|
@@ -11,6 +11,7 @@ import '../shared/common/smp-generic-constructor.type.js';
|
|
|
11
11
|
import '../shared/utils/cache/smp-browser-cache.class.js';
|
|
12
12
|
import '../shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
13
13
|
import '../shared/utils/cache/smp-abstract-cache-strategy.class.js';
|
|
14
|
+
import 'rxjs';
|
|
14
15
|
import '../shared/utils/cache/smp-cached-value.interface.js';
|
|
15
16
|
import '../shared/api/smp-rest-verbs.enum.js';
|
|
16
17
|
import '../smp-logger-methods.class-F7p-lMeQ.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-FAYDNSZG.js";import"../chunk-YFGB7SCJ.js";import{a as
|
|
1
|
+
import"../chunk-FAYDNSZG.js";import"../chunk-YFGB7SCJ.js";import{a as m}from"../chunk-7MD4IY4X.js";import"../chunk-LB7RIIRT.js";import"../chunk-WLD2KYV4.js";import"../chunk-4A2VEL4I.js";import{a as f}from"../chunk-W462XDMF.js";import"../chunk-RCI7NEJO.js";import"../chunk-ZNC4KYAS.js";import"../chunk-SDQLEPBS.js";import{a as r}from"../chunk-3XWLMKWI.js";import"../chunk-FAUAQNPB.js";import"../chunk-Z7KKB4KI.js";import"../chunk-YYOHQHR4.js";import"../chunk-S3E7FKAY.js";import"../chunk-QECKVXF4.js";import"../chunk-WTEJYEK2.js";import{a as o}from"../chunk-V2OQU7B5.js";import"../chunk-GALYBKBP.js";import"../chunk-3AFPQCOH.js";import"../chunk-5VCNTUI6.js";import"../chunk-DADFHUII.js";import{a as e}from"../chunk-Z5KZUWJJ.js";import"../chunk-EI7MMDWY.js";export{f as SmpDynamoService,m as SmpFirebaseService,r as SmpHttpService,o as SmpHttpSessionStorageCache,e as SmpHttpStatusCodes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-U5DBFRKV.js";import"../../chunk-AV6X4R7W.js";import{a as f}from"../../chunk-2YYH6VGI.js";import"../../chunk-SXISZIFJ.js";import{a as g}from"../../chunk-4NS456EU.js";import{a as e}from"../../chunk-MD2DPFLF.js";import"../../chunk-NHNK7NE2.js";import"../../chunk-RCI7NEJO.js";import"../../chunk-ZNC4KYAS.js";import{a as d}from"../../chunk-
|
|
1
|
+
import"../../chunk-U5DBFRKV.js";import"../../chunk-AV6X4R7W.js";import{a as f}from"../../chunk-2YYH6VGI.js";import"../../chunk-SXISZIFJ.js";import{a as g}from"../../chunk-4NS456EU.js";import{a as e}from"../../chunk-MD2DPFLF.js";import"../../chunk-NHNK7NE2.js";import"../../chunk-RCI7NEJO.js";import"../../chunk-ZNC4KYAS.js";import{a as d}from"../../chunk-Z7KKB4KI.js";import{a as c}from"../../chunk-YYOHQHR4.js";import{a as b}from"../../chunk-S3E7FKAY.js";import{a}from"../../chunk-QECKVXF4.js";import"../../chunk-EI7MMDWY.js";export{f as SMP_HEALTHZ,e as SmpApiCommonUtils,d as SmpErrorResponse,c as SmpGenericResponse,b as SmpResponseMessage,a as SmpResponseMessageTypes,g as SmpRestVerbs};
|
|
@@ -8,17 +8,13 @@ import './smp-response-message-types.enum.js';
|
|
|
8
8
|
declare class SmpErrorResponse<T = any> extends SmpGenericResponse<T, SmpGenericResponseBase & Pick<SmpErrorResponse, "errorCode" | "timestamp" | "status">> {
|
|
9
9
|
protected _errorCode: number | string;
|
|
10
10
|
protected _status: number;
|
|
11
|
+
static get DEFAULT_MESSAGES(): SmpResponseMessage[];
|
|
11
12
|
get errorCode(): number | string;
|
|
12
13
|
get status(): number;
|
|
13
14
|
get timestamp(): number;
|
|
14
15
|
protected _timestamp: number;
|
|
15
16
|
constructor(messages?: SmpResponseMessage[], _errorCode?: number | string, _status?: number, data?: T);
|
|
16
|
-
|
|
17
|
-
* @deprecated
|
|
18
|
-
* @see SmpErrorResponse.create
|
|
19
|
-
*/
|
|
20
|
-
static build<T>(messages?: SmpErrorResponseCreateOpts<any>["messages"], errorCode?: number | string, status?: number, data?: T): SmpErrorResponse;
|
|
21
|
-
static create<T>({ messages, ...opts }: Partial<SmpErrorResponseCreateOpts<T>>): SmpErrorResponse;
|
|
17
|
+
static create<T>({ messages, ...opts }?: Partial<SmpErrorResponseCreateOpts<T>>): SmpErrorResponse;
|
|
22
18
|
/**
|
|
23
19
|
* This shouldn't be necessary, but it's a workaround for this bug https://github.com/typestack/class-transformer/issues/1807
|
|
24
20
|
* @param plain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-Z7KKB4KI.js";import"../../chunk-YYOHQHR4.js";import"../../chunk-S3E7FKAY.js";import"../../chunk-QECKVXF4.js";import"../../chunk-EI7MMDWY.js";export{a as SmpErrorResponse};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-NQICKEAS.js";import{a}from"../../chunk-S7DRNW2X.js";import{a as b}from"../../chunk-RJBWCWAE.js";import{a as c}from"../../chunk-
|
|
1
|
+
import"../../chunk-NQICKEAS.js";import{a}from"../../chunk-S7DRNW2X.js";import{a as b}from"../../chunk-RJBWCWAE.js";import{a as c}from"../../chunk-VP72PKJQ.js";import"../../chunk-XZEYUIQ6.js";import"../../chunk-Z7KKB4KI.js";import"../../chunk-YYOHQHR4.js";import"../../chunk-S3E7FKAY.js";import"../../chunk-QECKVXF4.js";import"../../chunk-Z5KZUWJJ.js";import"../../chunk-EI7MMDWY.js";export{a as SmpAesCrypt,b as SmpCrypto,c as SmpSecureCode};
|
|
@@ -8,6 +8,11 @@ declare class SmpSecureCode {
|
|
|
8
8
|
protected _crcLength: number;
|
|
9
9
|
protected _seed: string;
|
|
10
10
|
constructor(_baseCode: string);
|
|
11
|
+
/**
|
|
12
|
+
* Checks secure code, throws a 400 error on failure
|
|
13
|
+
* @param giftcardCode
|
|
14
|
+
* @param pinToVerify
|
|
15
|
+
*/
|
|
11
16
|
static check<T extends string>(giftcardCode: string, pinToVerify: T): asserts giftcardCode is T;
|
|
12
17
|
protected _encode(): string;
|
|
13
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-VP72PKJQ.js";import"../../chunk-XZEYUIQ6.js";import"../../chunk-Z7KKB4KI.js";import"../../chunk-YYOHQHR4.js";import"../../chunk-S3E7FKAY.js";import"../../chunk-QECKVXF4.js";import"../../chunk-Z5KZUWJJ.js";import"../../chunk-EI7MMDWY.js";export{a as SmpSecureCode};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-strategy.class.js';
|
|
1
2
|
export { smpRxjsCatchOnly } from './smp-rxjs-catch-only.function.js';
|
|
2
3
|
export { smpRxjsThrowIfEmpty } from './smp-rxjs-throw-if-empty.function.js';
|
|
3
4
|
export { smpRxjsThrowOnCondition } from './smp-rxjs-throw-on-condition.function.js';
|
|
4
5
|
import 'rxjs';
|
|
6
|
+
import '../utils/cache/smp-abstract-cache-strategy.class.js';
|
|
7
|
+
import '../utils/cache/smp-cached-value.interface.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-
|
|
1
|
+
import"../../chunk-6MJDU4CZ.js";import{a as d}from"../../chunk-QWZP25QT.js";import{a as b}from"../../chunk-QW43DOPY.js";import{a}from"../../chunk-JFKLRHIQ.js";import{a as c}from"../../chunk-FLTR4ZY6.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpAbstractRxjsTtlCacheStrategy,b as smpRxjsCatchOnly,c as smpRxjsThrowIfEmpty,d as smpRxjsThrowOnCondition};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { SmpAbstractCacheStrategy } from '../utils/cache/smp-abstract-cache-strategy.class.js';
|
|
3
|
+
import { SmpCachedValue } from '../utils/cache/smp-cached-value.interface.js';
|
|
4
|
+
|
|
5
|
+
declare abstract class SmpAbstractRxjsTtlCacheStrategy extends SmpAbstractCacheStrategy {
|
|
6
|
+
protected abstract _flushRaw(): Observable<void>;
|
|
7
|
+
protected abstract _readRaw(key: string): Observable<unknown | undefined>;
|
|
8
|
+
protected abstract _removeRaw(key: string): Observable<void>;
|
|
9
|
+
protected abstract _writeRaw(key: string, value: unknown, ttl?: number): Observable<void>;
|
|
10
|
+
flush(): Observable<void>;
|
|
11
|
+
read<T = unknown>(key: string): Observable<T | undefined>;
|
|
12
|
+
remove(key: string): Observable<void>;
|
|
13
|
+
write<T = unknown>(key: string, value: T, ttl?: number): Observable<void>;
|
|
14
|
+
protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { SmpAbstractRxjsTtlCacheStrategy };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-JFKLRHIQ.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpAbstractRxjsTtlCacheStrategy};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-strategy.class.js';
|
|
3
|
+
import '../utils/cache/smp-abstract-cache-strategy.class.js';
|
|
4
|
+
import '../utils/cache/smp-cached-value.interface.js';
|
|
5
|
+
|
|
6
|
+
declare class KikRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {
|
|
7
|
+
private static _storage;
|
|
8
|
+
protected get _staticSelf(): typeof KikRxjsInMemoryCache;
|
|
9
|
+
protected _flushRaw(): Observable<void>;
|
|
10
|
+
protected _readRaw(key: string): Observable<unknown | undefined>;
|
|
11
|
+
protected _removeRaw(key: string): Observable<void>;
|
|
12
|
+
protected _writeRaw(key: string, value: unknown): Observable<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { KikRxjsInMemoryCache };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-JFKLRHIQ.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import{a as s}from"../../chunk-EI7MMDWY.js";import{defer as e,of as r}from"rxjs";var i=class extends a{static{s(this,"KikRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return e(()=>(this._staticSelf._storage.clear(),r(void 0)))}_readRaw(t){return e(()=>r(this._staticSelf._storage.get(t)))}_removeRaw(t){return e(()=>(this._staticSelf._storage.delete(t),r(void 0)))}_writeRaw(t,o){return e(()=>(this._staticSelf._storage.set(t,o),r(void 0)))}};export{i as KikRxjsInMemoryCache};
|
|
@@ -4,3 +4,5 @@ export { SmpCachedValue } from './smp-cached-value.interface.js';
|
|
|
4
4
|
export { SmpAbstractCacheStrategy } from './smp-abstract-cache-strategy.class.js';
|
|
5
5
|
export { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.js';
|
|
6
6
|
export { SmpInMemoryCache } from './smp-in-memory-cache.class.js';
|
|
7
|
+
export { smpIsSmpCachedValue } from './smp-is-smp-cached-value.function.js';
|
|
8
|
+
import 'rxjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../chunk-
|
|
1
|
+
import"../../../chunk-B3OEBKFG.js";import"../../../chunk-EB55SS67.js";import"../../../chunk-FE4YONC4.js";import{a as e}from"../../../chunk-FAUAQNPB.js";import{a as d}from"../../../chunk-GALYBKBP.js";import{a as c}from"../../../chunk-3AFPQCOH.js";import{a as b}from"../../../chunk-5VCNTUI6.js";import{a}from"../../../chunk-DADFHUII.js";import"../../../chunk-EI7MMDWY.js";export{a as SmpAbstractCacheStrategy,c as SmpAbstractTtlCacheStrategy,d as SmpBrowserCache,e as SmpInMemoryCache,b as smpIsSmpCachedValue};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
|
|
1
3
|
declare abstract class SmpAbstractCacheStrategy {
|
|
2
|
-
abstract read<T = unknown>(key: string): T | undefined
|
|
3
|
-
abstract write<T = unknown>(key: string, value: T, ttl?: number): void
|
|
4
|
-
abstract remove(key: string): void
|
|
5
|
-
abstract flush(): void
|
|
4
|
+
abstract read<T = unknown>(key: string): T | undefined | Observable<T | undefined>;
|
|
5
|
+
abstract write<T = unknown>(key: string, value: T, ttl?: number): void | Observable<void>;
|
|
6
|
+
abstract remove(key: string): void | Observable<void>;
|
|
7
|
+
abstract flush(): void | Observable<void>;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export { SmpAbstractCacheStrategy };
|