@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,16 +1,17 @@
|
|
|
1
1
|
import { SmpAbstractCacheStrategy } from './smp-abstract-cache-strategy.class.js';
|
|
2
2
|
import { SmpCachedValue } from './smp-cached-value.interface.js';
|
|
3
|
+
import 'rxjs';
|
|
3
4
|
|
|
4
5
|
declare abstract class SmpAbstractTtlCacheStrategy extends SmpAbstractCacheStrategy {
|
|
5
6
|
protected abstract _flushRaw(): void;
|
|
6
7
|
protected abstract _readRaw(key: string): unknown | undefined;
|
|
7
8
|
protected abstract _removeRaw(key: string): void;
|
|
8
|
-
protected abstract _writeRaw(key: string, value: unknown): void;
|
|
9
|
+
protected abstract _writeRaw(key: string, value: unknown, ttl?: number): void;
|
|
9
10
|
flush(): void;
|
|
10
11
|
read<T = unknown>(key: string): T | undefined;
|
|
11
12
|
remove(key: string): void;
|
|
12
13
|
write<T = unknown>(key: string, value: T, ttl?: number): void;
|
|
13
|
-
protected
|
|
14
|
+
protected _isSmpCachedValue<T>(value: unknown): value is SmpCachedValue<T>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export { SmpAbstractTtlCacheStrategy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-
|
|
1
|
+
import{a}from"../../../chunk-3AFPQCOH.js";import"../../../chunk-5VCNTUI6.js";import"../../../chunk-DADFHUII.js";import"../../../chunk-EI7MMDWY.js";export{a as SmpAbstractTtlCacheStrategy};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.js';
|
|
2
2
|
import './smp-abstract-cache-strategy.class.js';
|
|
3
|
+
import 'rxjs';
|
|
3
4
|
import './smp-cached-value.interface.js';
|
|
4
5
|
|
|
5
6
|
declare class SmpBrowserCache extends SmpAbstractTtlCacheStrategy {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-
|
|
1
|
+
import{a}from"../../../chunk-GALYBKBP.js";import"../../../chunk-3AFPQCOH.js";import"../../../chunk-5VCNTUI6.js";import"../../../chunk-DADFHUII.js";import"../../../chunk-EI7MMDWY.js";export{a as SmpBrowserCache};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.js';
|
|
2
2
|
import './smp-abstract-cache-strategy.class.js';
|
|
3
|
+
import 'rxjs';
|
|
3
4
|
import './smp-cached-value.interface.js';
|
|
4
5
|
|
|
5
6
|
declare class SmpInMemoryCache extends SmpAbstractTtlCacheStrategy {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../../chunk-
|
|
1
|
+
import{a}from"../../../chunk-FAUAQNPB.js";import"../../../chunk-3AFPQCOH.js";import"../../../chunk-5VCNTUI6.js";import"../../../chunk-DADFHUII.js";import"../../../chunk-EI7MMDWY.js";export{a as SmpInMemoryCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../../chunk-5VCNTUI6.js";import"../../../chunk-EI7MMDWY.js";export{a as smpIsSmpCachedValue};
|
|
@@ -9,4 +9,6 @@ export { SmpCachedValue } from './cache/smp-cached-value.interface.js';
|
|
|
9
9
|
export { SmpAbstractCacheStrategy } from './cache/smp-abstract-cache-strategy.class.js';
|
|
10
10
|
export { SmpAbstractTtlCacheStrategy } from './cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
11
11
|
export { SmpInMemoryCache } from './cache/smp-in-memory-cache.class.js';
|
|
12
|
+
export { smpIsSmpCachedValue } from './cache/smp-is-smp-cached-value.function.js';
|
|
12
13
|
import '../api/smp-rest-verbs.enum.js';
|
|
14
|
+
import 'rxjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-T3P4NVTG.js";import"../../chunk-
|
|
1
|
+
import"../../chunk-T3P4NVTG.js";import"../../chunk-B3OEBKFG.js";import"../../chunk-EB55SS67.js";import"../../chunk-FE4YONC4.js";import{a as g}from"../../chunk-DTVHTARR.js";import"../../chunk-DOKJQH4K.js";import"../../chunk-R6VG4656.js";import{a as h}from"../../chunk-4UTF5FWK.js";import"../../chunk-NIN4PUZX.js";import{a as j}from"../../chunk-RGLXAD7B.js";import{a as i}from"../../chunk-MMNEY2JK.js";import"../../chunk-4NS456EU.js";import{a as f}from"../../chunk-ZNC4KYAS.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,g as SmpCommonUtils,h as SmpFilterException,e as SmpInMemoryCache,j as SmpRegularExpressions,i as SmpSid,b as smpIsSmpCachedValue,f as smpNoop};
|
|
@@ -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>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-DTVHTARR.js";import"../../chunk-DOKJQH4K.js";import"../../chunk-R6VG4656.js";import"../../chunk-4NS456EU.js";import"../../chunk-EI7MMDWY.js";export{a as SmpCommonUtils};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonysamperi/ts-mapi-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A set of shared utils to be used at BE or FE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@aws-sdk/util-dynamodb": "^3.758.0",
|
|
46
46
|
"class-transformer": "^0.5.1",
|
|
47
47
|
"firebase": "^11.4.0",
|
|
48
|
-
"reflect-metadata": "^0.
|
|
48
|
+
"reflect-metadata": "^0.2.2",
|
|
49
49
|
"rxjs": "^7.5.6",
|
|
50
50
|
"ts-luxon": "^6.0.0",
|
|
51
51
|
"zod": "^3.24.4"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as s}from"./chunk-DADFHUII.js";import{a as t}from"./chunk-EI7MMDWY.js";import{DateTime as o}from"ts-luxon";var a=class extends s{static{t(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let r=this._readRaw(e);if(this._isKikCachedValue(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);return}let n=o.now().ts+i*1e3,p={value:r,expiry:n};this._writeRaw(e,p)}_isKikCachedValue(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}};export{a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as h,b as c,d as i}from"./chunk-XZEYUIQ6.js";import{a as r}from"./chunk-RZ4YI35O.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.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",o.BadRequest)}_encode(){let e=new i;return e.update(c.parse(this._seed+this._baseCode)),e.finalize().toString(h).substring(0,this._crcLength).toUpperCase()}};export{n as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-R6VG4656.js";import{a as u}from"./chunk-DOKJQH4K.js";import{a as p}from"./chunk-4NS456EU.js";import{a as c}from"./chunk-EI7MMDWY.js";var f=class l{static{c(this,"SmpCommonUtils")}static arrayRemove(t,e){let r=[],s=t.filter((i,n)=>e(i,n)&&r.push(n));return r.reverse().forEach(i=>t.splice(i,1)),s}static assertIsArray(t,e){if(!Array.isArray(t))throw new Error(e||"KikCommonUtils => val was not an array")}static assertIsBoolean(t,e){if(!this.isBoolean(t))throw new Error(e||"KikCommonUtils => val was not boolean")}static assertIsFunction(t,e){if(!this.isFunction(t))throw new Error(e||"KikCommonUtils => entity was not a function")}static assertIsInstance(t,e,r){if(!(t instanceof e))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(t,e){if(this.isEmpty(t))throw new Error(e||"KikCommonUtils => entity was empty")}static assertIsNumber(t,e){if(typeof t!="number")throw new Error(e||"KikCommonUtils => val was not numeric")}static assertIsNumeric(t,e){if(!this.isNumeric(t))throw new Error(e||"KikCommonUtils => val was not numeric")}static assertIsObject(t,e){if(!this.isObject(t))throw new Error(e||"KikCommonUtils => val was not an object")}static assertIsString(t,e){if(!this.isString(t))throw new Error(e||"KikCommonUtils => val was not a string")}static assertIsTruthy(t,e){if(!t)throw new Error(e||"KikCommonUtils => condition wasn't truthy")}static buildPath(...t){let e=t.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return e.startsWith("http")&&!e.endsWith("/")?`${e}/`:e}static downloadBlob(t,e){let r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.setAttribute("download",e),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let e="0123456789abcdef",r="";for(let s=0;s<t;s++){let i=Math.floor(Math.random()*e.length);r+=e[i]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}static getDecimalPrecision(t){if(this.assertIsNumeric(t),!isFinite(+t))return 0;let e=1,r=0;for(;Math.round(+t*e)/e!==t;)e*=10,r++;return r}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 e=new Option().style;return e.color=t,e.color!==""}static isEmpty(t){return!t&&t!==0}static isEqual(t,e){function r(){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!l.isEqual(t[o],e[o]))return!1;return!0}c(r,"areArraysEqual");function s(){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&!l.isEqual(t[o],e[o]))return!1;return!0}c(s,"areObjectsEqual");function i(){return t.toString()===e.toString()}c(i,"areFunctionsEqual");function n(){return t===e}c(n,"arePrimativesEqual");let a=this.getType(t);return a!==this.getType(e)?!1:a==="array"?r():a==="object"?s():a==="function"?i():n()}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 e=this.getType(t);return e!=="function"&&(e!=="object"||!t)}static isString(t){return typeof t=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(t,e){if(this.assertIsFunction(e,`CommonUtils => expected type of iteratee to be Function, got ${typeof e}`),this.isObject(t))return Object.entries(t).reduce((r,[s,i])=>(r.push(e(i,s)),r),[]);if(Array.isArray(t))return t.map(e);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof e}`)}static mapObjectKeys(t,e){return Object.entries(t).reduce((r,[s,i])=>(r[s]=e.call(null,s,i),r),{})}static mapObjectValues(t,e){return this.isObject(t)?Object.entries(t).reduce((r,[s,i])=>(r[s]=e.call(null,i,s),r),{}):{}}static noop(){}static objectHasValue(t,e){return!!~Object.values(t).filter(r=>this.isEqual(r,e))}static parseBoolean(t){return t?/^true$/i.test(t):!1}static parseJsonSafely(t){try{return JSON.parse(t)}catch(e){console.warn("KikCommonUtils => couldn't parse json string",{str:t,error:e});return}}static pick(t,e){return e.reduce((r,s)=>(s in t&&(r[s]=t[s]),r),{})}static runSafely(t,e=null,r=[]){if(this.isFunction(t))return t.apply(e,r)}static sleep(t){return new Promise(e=>setTimeout(e,t))}static sprintf(t,...e){return this.isString(t)&&e.length?this.sprintf(t.replace("%s",String(e.shift())),...e):t}static stripComments(t){return typeof t=="string"?t.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):t}static submitFakeForm({action:t,method:e=p.POST,data:r,target:s}){let i=Object.entries(r||{}).map(([a,o])=>`<input name="${a}" type="hidden" value="${o}" />`),n=document.createElement("form");n.method=e,n.action=t,n.innerHTML=`${i}`,n.target=s||"_self",document.body.append(n),n.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((e,r,s)=>(r=r.toLowerCase(),e+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(t){return this.toCamelCase(t).replace(/^(.)/,e=>e.toUpperCase())}static toSnakeCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(t){return this.toSnakeCase(t).toUpperCase()}static words(t,e){return e===void 0?(u.HAS_UNICODE_WORD(t)?u.unicodeWords(t):m(t))||[]:t.match(e)||[]}};export{f as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as l}from"./chunk-YYOHQHR4.js";import{a as c}from"./chunk-S3E7FKAY.js";import{a}from"./chunk-EI7MMDWY.js";import{Expose as R,plainToInstance as _}from"class-transformer";function d(n,e,t,s){var r=arguments.length,o=r<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,s);else for(var u=n.length-1;u>=0;u--)(p=n[u])&&(o=(r<3?p(o):r>3?p(e,t,o):p(e,t))||o);return r>3&&o&&Object.defineProperty(e,t,o),o}a(d,"_ts_decorate");function m(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}a(m,"_ts_metadata");function f(){return[new c("GENERIC_ERROR")]}a(f,"getDefaultMessages");var i=class n extends l{static{a(this,"SmpErrorResponse")}_errorCode;_status;get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=f(),t="GENERIC_ERROR",s=500,r){super(e,r),this._errorCode=t,this._status=s,this._timestamp=Date.now()}static build(e=f(),t,s,r){return new n(c.sanitizeMessages(e),t,s,r)}static create({messages:e=f(),...t}){return new n(c.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=_(g,e,{excludePrefixes:["_"]}),s=new n;return Object.getOwnPropertyNames(t).forEach(r=>{r in s&&(s[r]=t[r])}),s}};d([R(),m("design:type",Object),m("design:paramtypes",[])],i.prototype,"errorCode",null);d([R(),m("design:type",Number),m("design:paramtypes",[])],i.prototype,"timestamp",null);var g=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};
|
|
File without changes
|
|
File without changes
|