@tonysamperi/ts-mapi-core 1.1.0 → 1.3.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 +6 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +4 -2
- 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 +1 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs +2 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs.map +1 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.d.cts +5 -0
- package/dist/esm/{chunk-NPHREL4D.js → chunk-ITQRQR6W.js} +1 -1
- package/dist/esm/chunk-KZ3N6XCU.js +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/shared/rxjs/index.d.ts +1 -0
- package/dist/esm/shared/rxjs/index.js +1 -1
- package/dist/esm/shared/rxjs/smp-rxjs-catch-only.function.d.ts +5 -0
- package/dist/esm/shared/rxjs/smp-rxjs-catch-only.function.js +1 -0
- package/dist/esm/shared/utils/index.js +1 -1
- package/dist/esm/shared/utils/smp-common-utils.class.js +1 -1
- package/package.json +3 -9
- /package/dist/esm/{chunk-WVAB4IBD.js → chunk-L6UZLRQU.js} +0 -0
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SmpFirebaseService as SmpFirebaseService$1 } from './services/firebase/smp-firebase.service.cjs';
|
|
2
2
|
import { SmpDynamoService as SmpDynamoService$1 } from './services/smp-dynamo.service.cjs';
|
|
3
|
+
import { smpRxjsCatchOnly as smpRxjsCatchOnly$1 } from './shared/rxjs/smp-rxjs-catch-only.function.cjs';
|
|
3
4
|
import { smpRxjsThrowIfEmpty as smpRxjsThrowIfEmpty$1 } from './shared/rxjs/smp-rxjs-throw-if-empty.function.cjs';
|
|
4
5
|
import { smpRxjsThrowOnCondition as smpRxjsThrowOnCondition$1 } from './shared/rxjs/smp-rxjs-throw-on-condition.function.cjs';
|
|
5
6
|
export { SmpApiCommonUtils } from './shared/api/smp-api-common-utils.class.cjs';
|
|
@@ -50,11 +51,12 @@ import 'ts-luxon';
|
|
|
50
51
|
import './shared/utils/smp-gcpsid-raw.interface.cjs';
|
|
51
52
|
import './services/http/smp-dynamic-fetch-return.type.cjs';
|
|
52
53
|
|
|
53
|
-
declare const VERSION: "1.
|
|
54
|
+
declare const VERSION: "1.3.0";
|
|
54
55
|
|
|
56
|
+
declare const smpRxjsCatchOnly: typeof smpRxjsCatchOnly$1;
|
|
55
57
|
declare const smpRxjsThrowIfEmpty: typeof smpRxjsThrowIfEmpty$1;
|
|
56
58
|
declare const smpRxjsThrowOnCondition: typeof smpRxjsThrowOnCondition$1;
|
|
57
59
|
declare const SmpDynamoService: typeof SmpDynamoService$1;
|
|
58
60
|
declare const SmpFirebaseService: typeof SmpFirebaseService$1;
|
|
59
61
|
|
|
60
|
-
export { SmpDynamoService, SmpFirebaseService, VERSION, smpRxjsThrowIfEmpty, smpRxjsThrowOnCondition };
|
|
62
|
+
export { SmpDynamoService, SmpFirebaseService, VERSION, smpRxjsCatchOnly, smpRxjsThrowIfEmpty, smpRxjsThrowOnCondition };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var b=(r,e)=>{for(var o in e)i(r,o,{get:e[o],enumerable:!0})},c=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!T.call(r,n)&&n!==o&&i(r,n,{get:()=>e[n],enumerable:!(t=u(e,n))||t.enumerable});return r};var x=r=>c(i({},"__esModule",{value:!0}),r);var v={};b(v,{smpRxjsCatchOnly:()=>f,smpRxjsThrowIfEmpty:()=>a,smpRxjsThrowOnCondition:()=>m});module.exports=x(v);var p=require("rxjs");function f(r,e){return o=>o.pipe((0,p.catchError)(t=>t instanceof r?e(t):(0,p.throwError)(()=>t)))}var O=require("rxjs");function a(r=E){return e=>e.pipe((0,O.map)(o=>{if(~y.indexOf(JSON.stringify(o)))throw r(o);return o}))}var y=[void 0,null,!1,0,"","0",[],{}].map(r=>JSON.stringify(r)),E=()=>new Error;var s=require("rxjs");function m(r,e){return o=>o.pipe((0,s.filter)(t=>!r(t)),(0,s.defaultIfEmpty)(!1),a(e))}0&&(module.exports={smpRxjsCatchOnly,smpRxjsThrowIfEmpty,smpRxjsThrowOnCondition});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/rxjs/index.ts","../../../../src/shared/rxjs/smp-rxjs-throw-if-empty.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts"],"sourcesContent":["export {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function\";\nexport {smpRxjsThrowOnCondition} from \"./smp-rxjs-throw-on-condition.function\";\n","import {map, Observable, OperatorFunction} from \"rxjs\";\n\n/**\n * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link Error}.\n *\n * ## Example\n *\n * Throw an error if the query didn't match anything\n *\n * ```ts\n * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const query$ = of([]);\n *\n * query$.pipe(\n * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))\n * )\n * .subscribe({\n * next() {\n * console.log(\"The query had results\");\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function smpRxjsThrowIfEmpty<T>(errorFactory: (value: T) => any = defaultErrorFactory): OperatorFunction<T, T> {\n return (source: Observable<T>) => source.pipe(\n map(v => {\n if (~emptyValues.indexOf(JSON.stringify(v))) {\n throw errorFactory(v);\n }\n\n return v;\n })\n );\n}\n\nconst emptyValues = [void 0, null, false, 0, \"\", \"0\", [], {}].map((v) =>\n JSON.stringify(v)\n);\n\nconst defaultErrorFactory = (): Error => new Error();\n","import {defaultIfEmpty, filter, Observable, OperatorFunction} from \"rxjs\";\n//\nimport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\n\n/**\n * Custom RxJS operator that filters the source observable based on a condition\n * and throws an error if the resulting observable is empty.\n *\n * @template T The type of items emitted by the source observable.\n * @param {function(T): boolean} condition - A function that takes a value from the source observable and returns a boolean.\n * If the function returns `true`, the value will be emitted; otherwise, it will be filtered out.\n * @param {function(): Error} [errorFactory] - An optional function that returns an error to be thrown if the resulting observable is empty.\n * If not provided, a default error will be thrown.\n * @returns {OperatorFunction<T, T>} An operator function that can be used in the RxJS pipeline.\n *\n * @example\n * import { of } from 'rxjs';\n * import { kikRxjsThrowOnCondition } from \"./path-to-your-file\";\n *\n * const source$ = of(1, 5, -3, 7, 12).pipe(\n * kikRxjsThrowOnCondition(value => value >= 0, () => new Error(\"Value is less than 0\")),\n * kikRxjsThrowOnCondition(value => value > 12, () => new Error(\"Value is lower than 12\"))\n * );\n *\n * source$.subscribe({\n * next: value => console.log(\"Value:\", value),\n * error: err => console.error(\"Error:\", err)\n * });\n */\nexport function smpRxjsThrowOnCondition<T>(\n condition: (value: T) => boolean,\n errorFactory?: () => any\n): OperatorFunction<T, T> {\n return (source: Observable<T>) =>\n source.pipe(\n filter((v: T) => !condition(v)), // Invert the condition because if I need to throw on that condition we should filter all that don't match\n defaultIfEmpty(false as unknown as T), // We nuke type errors, cause when falsy kikRxjsThrowIfEmpty will throw\n smpRxjsThrowIfEmpty(errorFactory)\n );\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/rxjs/index.ts","../../../../src/shared/rxjs/smp-rxjs-catch-only.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-if-empty.function.ts","../../../../src/shared/rxjs/smp-rxjs-throw-on-condition.function.ts"],"sourcesContent":["export {smpRxjsCatchOnly} from \"./smp-rxjs-catch-only.function\";\nexport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\nexport {smpRxjsThrowOnCondition} from \"./smp-rxjs-throw-on-condition.function.js\";\n","import {Observable, OperatorFunction, catchError, throwError} from \"rxjs\";\nimport type {ObservableInput, ObservedValueOf} from \"rxjs\";\n\nexport function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(\n errorType: new (...args: any[]) => E,\n selector: (err: E) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return (source: Observable<T>) =>\n source.pipe(\n catchError((err: unknown) => {\n if (err instanceof errorType) {\n return selector(err as E);\n }\n return throwError(() => err);\n })\n );\n}\n","import {map, Observable, OperatorFunction} from \"rxjs\";\n\n/**\n * If the source observable completes emitting an empty value (empty array or object will be considered empty), it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link Error}.\n *\n * ## Example\n *\n * Throw an error if the query didn't match anything\n *\n * ```ts\n * import { of, takeUntil, timer, throwIfEmpty } from 'rxjs';\n *\n * const query$ = of([]);\n *\n * query$.pipe(\n * smpRxjsThrowIfEmpty(() => new Error('The query had no results'))\n * )\n * .subscribe({\n * next() {\n * console.log(\"The query had results\");\n * },\n * error(err) {\n * console.error(err.message);\n * }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function smpRxjsThrowIfEmpty<T>(errorFactory: (value: T) => any = defaultErrorFactory): OperatorFunction<T, T> {\n return (source: Observable<T>) => source.pipe(\n map(v => {\n if (~emptyValues.indexOf(JSON.stringify(v))) {\n throw errorFactory(v);\n }\n\n return v;\n })\n );\n}\n\nconst emptyValues = [void 0, null, false, 0, \"\", \"0\", [], {}].map((v) =>\n JSON.stringify(v)\n);\n\nconst defaultErrorFactory = (): Error => new Error();\n","import {defaultIfEmpty, filter, Observable, OperatorFunction} from \"rxjs\";\n//\nimport {smpRxjsThrowIfEmpty} from \"./smp-rxjs-throw-if-empty.function.js\";\n\n/**\n * Custom RxJS operator that filters the source observable based on a condition\n * and throws an error if the resulting observable is empty.\n *\n * @template T The type of items emitted by the source observable.\n * @param {function(T): boolean} condition - A function that takes a value from the source observable and returns a boolean.\n * If the function returns `true`, the value will be emitted; otherwise, it will be filtered out.\n * @param {function(): Error} [errorFactory] - An optional function that returns an error to be thrown if the resulting observable is empty.\n * If not provided, a default error will be thrown.\n * @returns {OperatorFunction<T, T>} An operator function that can be used in the RxJS pipeline.\n *\n * @example\n * import { of } from 'rxjs';\n * import { kikRxjsThrowOnCondition } from \"./path-to-your-file\";\n *\n * const source$ = of(1, 5, -3, 7, 12).pipe(\n * kikRxjsThrowOnCondition(value => value >= 0, () => new Error(\"Value is less than 0\")),\n * kikRxjsThrowOnCondition(value => value > 12, () => new Error(\"Value is lower than 12\"))\n * );\n *\n * source$.subscribe({\n * next: value => console.log(\"Value:\", value),\n * error: err => console.error(\"Error:\", err)\n * });\n */\nexport function smpRxjsThrowOnCondition<T>(\n condition: (value: T) => boolean,\n errorFactory?: () => any\n): OperatorFunction<T, T> {\n return (source: Observable<T>) =>\n source.pipe(\n filter((v: T) => !condition(v)), // Invert the condition because if I need to throw on that condition we should filter all that don't match\n defaultIfEmpty(false as unknown as T), // We nuke type errors, cause when falsy kikRxjsThrowIfEmpty will throw\n smpRxjsThrowIfEmpty(errorFactory)\n );\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,wBAAAC,EAAA,4BAAAC,IAAA,eAAAC,EAAAL,GCAA,IAAAM,EAAmE,gBAG5D,SAASC,EACZC,EACAC,EAC2C,CAC3C,OAAQC,GACJA,EAAO,QACH,cAAYC,GACJA,aAAeH,EACRC,EAASE,CAAQ,KAErB,cAAW,IAAMA,CAAG,CAC9B,CACL,CACR,CChBA,IAAAC,EAAgD,gBAmCzC,SAASC,EAAuBC,EAAkCC,EAA6C,CAClH,OAAQC,GAA0BA,EAAO,QACrC,OAAIC,GAAK,CACL,GAAI,CAACC,EAAY,QAAQ,KAAK,UAAUD,CAAC,CAAC,EACtC,MAAMH,EAAaG,CAAC,EAGxB,OAAOA,CACX,CAAC,CACL,CACJ,CAEA,IAAMC,EAAc,CAAC,OAAQ,KAAM,GAAO,EAAG,GAAI,IAAK,CAAC,EAAG,CAAC,CAAC,EAAE,IAAKD,GAC/D,KAAK,UAAUA,CAAC,CACpB,EAEMF,EAAsB,IAAa,IAAI,MCnD7C,IAAAI,EAAmE,gBA6B5D,SAASC,EACZC,EACAC,EACsB,CACtB,OAAQC,GACJA,EAAO,QACH,UAAQC,GAAS,CAACH,EAAUG,CAAC,CAAC,KAC9B,kBAAe,EAAqB,EACpCC,EAAoBH,CAAY,CACpC,CACR","names":["rxjs_exports","__export","smpRxjsCatchOnly","smpRxjsThrowIfEmpty","smpRxjsThrowOnCondition","__toCommonJS","import_rxjs","smpRxjsCatchOnly","errorType","selector","source","err","import_rxjs","smpRxjsThrowIfEmpty","errorFactory","defaultErrorFactory","source","v","emptyValues","import_rxjs","smpRxjsThrowOnCondition","condition","errorFactory","source","v","smpRxjsThrowIfEmpty"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:!0})},i=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of p(r))!u.call(e,o)&&o!==n&&s(e,o,{get:()=>r[o],enumerable:!(t=O(r,o))||t.enumerable});return e};var c=e=>i(s({},"__esModule",{value:!0}),e);var l={};b(l,{smpRxjsCatchOnly:()=>f});module.exports=c(l);var a=require("rxjs");function f(e,r){return n=>n.pipe((0,a.catchError)(t=>t instanceof e?r(t):(0,a.throwError)(()=>t)))}0&&(module.exports={smpRxjsCatchOnly});
|
|
2
|
+
//# sourceMappingURL=smp-rxjs-catch-only.function.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/rxjs/smp-rxjs-catch-only.function.ts"],"sourcesContent":["import {Observable, OperatorFunction, catchError, throwError} from \"rxjs\";\nimport type {ObservableInput, ObservedValueOf} from \"rxjs\";\n\nexport function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(\n errorType: new (...args: any[]) => E,\n selector: (err: E) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return (source: Observable<T>) =>\n source.pipe(\n catchError((err: unknown) => {\n if (err instanceof errorType) {\n return selector(err as E);\n }\n return throwError(() => err);\n })\n );\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmE,gBAG5D,SAASF,EACZG,EACAC,EAC2C,CAC3C,OAAQC,GACJA,EAAO,QACH,cAAYC,GACJA,aAAeH,EACRC,EAASE,CAAQ,KAErB,cAAW,IAAMA,CAAG,CAC9B,CACL,CACR","names":["smp_rxjs_catch_only_function_exports","__export","smpRxjsCatchOnly","__toCommonJS","import_rxjs","errorType","selector","source","err"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ObservableInput, OperatorFunction, ObservedValueOf } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
declare function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(errorType: new (...args: any[]) => E, selector: (err: E) => O): OperatorFunction<T, T | ObservedValueOf<O>>;
|
|
4
|
+
|
|
5
|
+
export { smpRxjsCatchOnly };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as l}from"./chunk-IZD3BY3X.js";import{a as c}from"./chunk-HTUF5T5K.js";var y=class u{static arrayRemove(t,e){let r=[],n=t.filter((s,i)=>e(s,i)&&r.push(i));return r.reverse().forEach(s=>t.splice(s,1)),n}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),n=document.createElement("a");n.href=r,n.setAttribute("download",e),document.body.appendChild(n),n.click()}static generateRandomHexString(t=12){let e="0123456789abcdef",r="";for(let n=0;n<t;n++){let s=Math.floor(Math.random()*e.length);r+=e[s]}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(!u.isEqual(t[o],e[o]))return!1;return!0}function n(){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&!u.isEqual(t[o],e[o]))return!1;return!0}function s(){return t.toString()===e.toString()}function i(){return t===e}let a=this.getType(t);return a!==this.getType(e)?!1:a==="array"?r():a==="object"?n():a==="function"?s():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 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,[n,s])=>(r.push(e(s,n)),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,[n,s])=>(r[n]=e.call(null,n,s),r),{})}static mapObjectValues(t,e){return this.isObject(t)?Object.entries(t).reduce((r,[n,s])=>(r[n]=e.call(null,s,n),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,n)=>(n in t&&(r[n]=t[n]),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="POST",data:r,target:n}){let s=Object.entries(r||{}).map(([a,o])=>`<input name="${a}" type="hidden" value="${o}" />`),i=document.createElement("form");i.method=e,i.action=t,i.innerHTML=`${s}`,i.target=n||"_self",document.body.append(i),i.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((e,r,n)=>(r=r.toLowerCase(),e+(n?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?(c.HAS_UNICODE_WORD(t)?c.unicodeWords(t):l(t))||[]:t.match(e)||[]}};export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{catchError as o,throwError as a}from"rxjs";function u(e,n){return t=>t.pipe(o(r=>r instanceof e?n(r):a(()=>r)))}export{u 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 { smpRxjsCatchOnly } from './shared/rxjs/smp-rxjs-catch-only.function.js';
|
|
30
31
|
export { smpRxjsThrowIfEmpty } from './shared/rxjs/smp-rxjs-throw-if-empty.function.js';
|
|
31
32
|
export { smpRxjsThrowOnCondition } from './shared/rxjs/smp-rxjs-throw-on-condition.function.js';
|
|
32
33
|
export { SmpCommonUtils } from './shared/utils/smp-common-utils.class.js';
|
|
@@ -50,6 +51,6 @@ import 'firebase/auth';
|
|
|
50
51
|
import '@aws-sdk/util-dynamodb';
|
|
51
52
|
import '@aws-sdk/client-dynamodb';
|
|
52
53
|
|
|
53
|
-
declare const VERSION: "1.
|
|
54
|
+
declare const VERSION: "1.3.0";
|
|
54
55
|
|
|
55
56
|
export { VERSION };
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-Q77KUWBZ.js";import"./chunk-BWZ6SM6P.js";import{a as y}from"./chunk-2Q3A3WHV.js";import"./chunk-
|
|
1
|
+
import"./chunk-Q77KUWBZ.js";import"./chunk-BWZ6SM6P.js";import{a as y}from"./chunk-2Q3A3WHV.js";import"./chunk-L6UZLRQU.js";import{a as C}from"./chunk-KZ3N6XCU.js";import{a as L}from"./chunk-QCY65CEY.js";import{a as E}from"./chunk-RQMWVXXI.js";import"./chunk-T3P4NVTG.js";import"./chunk-THUEL7AA.js";import"./chunk-VU2BXAMO.js";import{a as N}from"./chunk-ITQRQR6W.js";import"./chunk-IZD3BY3X.js";import{a as O}from"./chunk-7FC5ZQDK.js";import"./chunk-NIN4PUZX.js";import{a as d}from"./chunk-NRABUNRU.js";import{a as U}from"./chunk-VFSRM2TJ.js";import"./chunk-HTUF5T5K.js";import"./chunk-D66G2KIE.js";import"./chunk-HOM5S5W3.js";import"./chunk-EZ4NN7JG.js";import"./chunk-BIAKHPIF.js";import{a as g}from"./chunk-JP7P2SIN.js";import{a as V}from"./chunk-5D4O273A.js";import{a as R}from"./chunk-YSQCITEQ.js";import"./chunk-NQICKEAS.js";import{a as D}from"./chunk-5VHPHFOY.js";import{a as F}from"./chunk-HA3BETKN.js";import{a as I}from"./chunk-XBKDBU3A.js";import"./chunk-J6MWJEP3.js";import"./chunk-EHABREBA.js";import"./chunk-VA34RBMX.js";import"./chunk-VHMFSRVM.js";import"./chunk-U5DBFRKV.js";import"./chunk-BCKQYO6O.js";import{a}from"./chunk-2YYH6VGI.js";import"./chunk-77XHVETN.js";import{a as n}from"./chunk-2DFXGAWG.js";import{a as _}from"./chunk-4S2VS5TZ.js";import"./chunk-DDTSA6ND.js";import{a as o}from"./chunk-APLEU3C2.js";import"./chunk-SCRNHKVE.js";import"./chunk-JSNCOALE.js";import{a as r}from"./chunk-7ZJA47VN.js";import{a as B}from"./chunk-C2FQU2TR.js";import{a as v}from"./chunk-XBCBZ3FR.js";import{a as b}from"./chunk-VQRTVHM5.js";import"./chunk-73A5OTVH.js";import{a as s}from"./chunk-NOYOAWWX.js";import"./chunk-SDQLEPBS.js";import"./chunk-24AHYMAJ.js";import{a as c}from"./chunk-RFVBH4FB.js";import{a as i}from"./chunk-QU4A4JHG.js";import{a as p}from"./chunk-IFZTF7A7.js";import{a as m}from"./chunk-GYZH6FYB.js";import{a as e}from"./chunk-JCZRE6MU.js";import{a as S}from"./chunk-BYMUL3M4.js";import{a as x}from"./chunk-BYEFRPVT.js";import{a as f}from"./chunk-2TQSQ6UP.js";import{a as t}from"./chunk-H5UU33RN.js";import"./chunk-JFKSI6I7.js";var h="1.3.0";export{a as SMP_HEALTHZ,D as SmpAesCrypt,_ as SmpApiCommonUtils,e as SmpBrowserCache,N as SmpCommonUtils,F as SmpCrypto,o as SmpDynamoService,S as SmpErrorResponse,O as SmpFilterException,B as SmpFirebaseErrors,r as SmpFirebaseService,x as SmpGenericResponse,g as SmpGiftcardTransaction,V as SmpGiftcardTransactionHashStrategies,R as SmpGiftcardTransactionOps,i as SmpHttpService,m as SmpHttpSessionStorageCache,c as SmpHttpStatusCodes,p as SmpInMemoryCache,y as SmpMarketingCloudValidators,d as SmpRegularExpressions,f as SmpResponseMessage,t as SmpResponseMessageTypes,n as SmpRestVerbs,I as SmpSecureCode,U as SmpSid,v as SmpSocialSignInKeys,b as SmpSocialSignInUxModes,h as VERSION,s as smpNoop,C as smpRxjsCatchOnly,E as smpRxjsThrowIfEmpty,L as smpRxjsThrowOnCondition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-
|
|
1
|
+
import"../../chunk-L6UZLRQU.js";import{a}from"../../chunk-KZ3N6XCU.js";import{a as c}from"../../chunk-QCY65CEY.js";import{a as b}from"../../chunk-RQMWVXXI.js";import"../../chunk-JFKSI6I7.js";export{a as smpRxjsCatchOnly,b as smpRxjsThrowIfEmpty,c as smpRxjsThrowOnCondition};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ObservableInput, OperatorFunction, ObservedValueOf } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
declare function smpRxjsCatchOnly<T, E extends Error, O extends ObservableInput<any>>(errorType: new (...args: any[]) => E, selector: (err: E) => O): OperatorFunction<T, T | ObservedValueOf<O>>;
|
|
4
|
+
|
|
5
|
+
export { smpRxjsCatchOnly };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-KZ3N6XCU.js";import"../../chunk-JFKSI6I7.js";export{a as smpRxjsCatchOnly};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-T3P4NVTG.js";import{a as d}from"../../chunk-
|
|
1
|
+
import"../../chunk-T3P4NVTG.js";import"../../chunk-THUEL7AA.js";import"../../chunk-VU2BXAMO.js";import{a as d}from"../../chunk-ITQRQR6W.js";import"../../chunk-IZD3BY3X.js";import{a as e}from"../../chunk-7FC5ZQDK.js";import"../../chunk-NIN4PUZX.js";import{a as g}from"../../chunk-NRABUNRU.js";import{a as f}from"../../chunk-VFSRM2TJ.js";import"../../chunk-HTUF5T5K.js";import"../../chunk-2DFXGAWG.js";import{a as c}from"../../chunk-NOYOAWWX.js";import{a as b}from"../../chunk-IFZTF7A7.js";import{a}from"../../chunk-JCZRE6MU.js";import"../../chunk-JFKSI6I7.js";export{a as SmpBrowserCache,d as SmpCommonUtils,e as SmpFilterException,b as SmpInMemoryCache,g as SmpRegularExpressions,f as SmpSid,c as smpNoop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-ITQRQR6W.js";import"../../chunk-IZD3BY3X.js";import"../../chunk-HTUF5T5K.js";import"../../chunk-2DFXGAWG.js";import"../../chunk-JFKSI6I7.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.3.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",
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
"firebase": "^11.4.0",
|
|
48
48
|
"reflect-metadata": "^0.1.14",
|
|
49
49
|
"rxjs": "^7.5.6",
|
|
50
|
-
"ts-luxon": "^6.0.0"
|
|
51
|
-
"zod": "^3.22.4"
|
|
50
|
+
"ts-luxon": "^6.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@aws-sdk/client-dynamodb": "^3.758.0",
|
|
@@ -64,10 +63,8 @@
|
|
|
64
63
|
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
65
64
|
"@typescript-eslint/parser": "^8.26.1",
|
|
66
65
|
"class-transformer": "^0.5.1",
|
|
67
|
-
"esbuild": "^0.25.1",
|
|
68
66
|
"eslint": "^9.21.0",
|
|
69
67
|
"firebase": "^11.4.0",
|
|
70
|
-
"glob": "^11.0.1",
|
|
71
68
|
"jest": "~29.7.0",
|
|
72
69
|
"reflect-metadata": "^0.1.14",
|
|
73
70
|
"replace-in-file": "^8.3.0",
|
|
@@ -79,10 +76,7 @@
|
|
|
79
76
|
"tslib": "^2.8.1",
|
|
80
77
|
"tsup": "^8.4.0",
|
|
81
78
|
"typescript": "~5.8.2",
|
|
82
|
-
"typescript-eslint": "^8.26.0"
|
|
83
|
-
"webpack": "^5.96.1",
|
|
84
|
-
"webpack-cli": "^5.1.4",
|
|
85
|
-
"zod": "^3.22.4"
|
|
79
|
+
"typescript-eslint": "^8.26.0"
|
|
86
80
|
},
|
|
87
81
|
"packageManager": "yarn@4.3.1"
|
|
88
82
|
}
|
|
File without changes
|