@tonysamperi/ts-mapi-core 1.4.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/README.md +4 -0
- package/changelog.md +11 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +20 -14
- 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 +4 -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 +4 -1
- 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 +4 -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-build-opts.interface.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/common/index.cjs.map +1 -1
- 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-catch-only.function.cjs +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.d.cts +1 -1
- 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 +5 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs +2 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.d.cts +10 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs +2 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.cts +17 -0
- 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 +11 -8
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +4 -0
- package/dist/cjs/shared/utils/{smp-gcpsid-raw.interface.cjs → cache/smp-cached-value.interface.cjs} +1 -1
- package/dist/cjs/shared/utils/cache/smp-cached-value.interface.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-cached-value.interface.d.cts +6 -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 +10 -7
- 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 +5 -1
- 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/cjs/shared/utils/smp-sid.class.cjs +1 -1
- package/dist/cjs/shared/utils/smp-sid.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/smp-sid.class.d.cts +4 -4
- package/dist/cjs/shared/zod/index.cjs +2 -0
- package/dist/cjs/shared/zod/index.cjs.map +1 -0
- package/dist/cjs/shared/zod/index.d.cts +3 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs +2 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs.map +1 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.d.cts +28 -0
- package/dist/esm/chunk-3AFPQCOH.js +1 -0
- package/dist/esm/{chunk-35U7P4SV.js → chunk-3XWLMKWI.js} +1 -1
- package/dist/esm/chunk-5VCNTUI6.js +1 -0
- package/dist/esm/chunk-DADFHUII.js +1 -0
- package/dist/esm/chunk-DTVHTARR.js +1 -0
- package/dist/esm/chunk-FAUAQNPB.js +1 -0
- package/dist/esm/chunk-GALYBKBP.js +1 -0
- package/dist/esm/chunk-JFKLRHIQ.js +1 -0
- package/dist/esm/{chunk-FUXO6KMS.js → chunk-MMNEY2JK.js} +1 -1
- package/dist/esm/chunk-O7TJDNO6.js +0 -0
- package/dist/esm/chunk-QPKVVZUA.js +1 -0
- package/dist/esm/chunk-QW43DOPY.js +1 -0
- package/dist/esm/{chunk-NIJJBDPY.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 +11 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/services/http/index.d.ts +4 -0
- package/dist/esm/services/http/index.js +1 -1
- package/dist/esm/services/http/smp-http-session-storage-cache.class.d.ts +4 -1
- 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 +4 -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-catch-only.function.d.ts +1 -1
- package/dist/esm/shared/rxjs/smp-rxjs-catch-only.function.js +1 -1
- 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 +5 -0
- package/dist/esm/shared/utils/cache/index.js +1 -1
- package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.d.ts +10 -0
- package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.js +1 -0
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.ts +17 -0
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js +1 -0
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.d.ts +11 -8
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.js +1 -1
- package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +4 -0
- package/dist/esm/shared/utils/cache/smp-cached-value.interface.d.ts +6 -0
- package/dist/esm/shared/utils/cache/smp-cached-value.interface.js +1 -0
- package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.d.ts +10 -7
- 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 +5 -1
- 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/dist/esm/shared/utils/smp-sid.class.d.ts +4 -4
- package/dist/esm/shared/utils/smp-sid.class.js +1 -1
- package/dist/esm/shared/zod/index.d.ts +3 -0
- package/dist/esm/shared/zod/index.js +1 -0
- package/dist/esm/shared/zod/smp-zod-date-time.definition.d.ts +28 -0
- package/dist/esm/shared/zod/smp-zod-date-time.definition.js +1 -0
- package/package.json +6 -4
- package/dist/cjs/shared/utils/smp-gcpsid-raw.interface.cjs.map +0 -1
- package/dist/cjs/shared/utils/smp-gcpsid-raw.interface.d.cts +0 -6
- package/dist/esm/chunk-CZTKNLYX.js +0 -1
- package/dist/esm/chunk-LDLBKVKD.js +0 -1
- package/dist/esm/chunk-OM2B3B4I.js +0 -1
- package/dist/esm/chunk-OXO327UX.js +0 -1
- package/dist/esm/chunk-QMTVV3AM.js +0 -1
- package/dist/esm/chunk-RZ4YI35O.js +0 -1
- package/dist/esm/shared/utils/smp-gcpsid-raw.interface.d.ts +0 -6
- /package/dist/esm/{chunk-L6UZLRQU.js → chunk-6MJDU4CZ.js} +0 -0
- /package/dist/esm/{chunk-THUEL7AA.js → chunk-B3OEBKFG.js} +0 -0
- /package/dist/esm/{shared/utils/smp-gcpsid-raw.interface.js → chunk-EB55SS67.js} +0 -0
|
@@ -5,6 +5,10 @@ export { smpNoop } from './smp-noop.function.js';
|
|
|
5
5
|
export { SmpRegularExpressions } from './smp-regular-expressions.class.js';
|
|
6
6
|
export { SmpBrowserCache } from './cache/smp-browser-cache.class.js';
|
|
7
7
|
export { SmpCacheStrategy } from './cache/smp-cache-strategy.interface.js';
|
|
8
|
+
export { SmpCachedValue } from './cache/smp-cached-value.interface.js';
|
|
9
|
+
export { SmpAbstractCacheStrategy } from './cache/smp-abstract-cache-strategy.class.js';
|
|
10
|
+
export { SmpAbstractTtlCacheStrategy } from './cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
8
11
|
export { SmpInMemoryCache } from './cache/smp-in-memory-cache.class.js';
|
|
12
|
+
export { smpIsSmpCachedValue } from './cache/smp-is-smp-cached-value.function.js';
|
|
9
13
|
import '../api/smp-rest-verbs.enum.js';
|
|
10
|
-
import '
|
|
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};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SmpCachedValue } from './cache/smp-cached-value.interface.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A util to generate session ids
|
|
5
5
|
*/
|
|
6
|
-
declare class SmpSid implements
|
|
6
|
+
declare class SmpSid implements SmpCachedValue<string> {
|
|
7
7
|
value: string;
|
|
8
8
|
expiry: number;
|
|
9
9
|
get active(): boolean;
|
|
@@ -11,8 +11,8 @@ declare class SmpSid implements SmpSidRaw {
|
|
|
11
11
|
get valid(): boolean;
|
|
12
12
|
protected _controlSuffix: string;
|
|
13
13
|
constructor(value?: string, expiry?: number);
|
|
14
|
-
static parse(raw:
|
|
15
|
-
toPlain():
|
|
14
|
+
static parse(raw: SmpCachedValue<string>): SmpSid;
|
|
15
|
+
toPlain(): SmpCachedValue<string>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { SmpSid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-MMNEY2JK.js";import"../../chunk-EI7MMDWY.js";export{a as SmpSid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../chunk-O7TJDNO6.js";import{a,b}from"../../chunk-QPKVVZUA.js";import"../../chunk-EI7MMDWY.js";export{a as SmpZodDateTime,b as smpZodDateTime};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import z, { ZodTypeDef, ParseInput, ParseReturnType } from 'zod';
|
|
2
|
+
import { DateTime } from 'ts-luxon';
|
|
3
|
+
|
|
4
|
+
interface SmpZodDateTimeCheck {
|
|
5
|
+
kind: "min" | "max" | "between";
|
|
6
|
+
min?: DateTime;
|
|
7
|
+
max?: DateTime;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
interface SmpZodDateTimeDef extends ZodTypeDef {
|
|
11
|
+
coerce: boolean;
|
|
12
|
+
checks: SmpZodDateTimeCheck[];
|
|
13
|
+
typeName: "SmpZodDateTime";
|
|
14
|
+
}
|
|
15
|
+
declare class SmpZodDateTime extends z.ZodType<DateTime, SmpZodDateTimeDef> {
|
|
16
|
+
constructor(def?: Partial<SmpZodDateTimeDef>);
|
|
17
|
+
_parse(input: ParseInput): ParseReturnType<DateTime>;
|
|
18
|
+
between(min: DateTime, max: DateTime, message?: string): this;
|
|
19
|
+
coerce(): this;
|
|
20
|
+
max(max: DateTime, message?: string): this;
|
|
21
|
+
min(min: DateTime, message?: string): this;
|
|
22
|
+
private _coerceToDateTime;
|
|
23
|
+
}
|
|
24
|
+
declare const smpZodDateTime: (opts?: {
|
|
25
|
+
coerce?: boolean;
|
|
26
|
+
}) => SmpZodDateTime;
|
|
27
|
+
|
|
28
|
+
export { SmpZodDateTime, smpZodDateTime };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../chunk-QPKVVZUA.js";import"../../chunk-EI7MMDWY.js";export{a as SmpZodDateTime,b as smpZodDateTime};
|
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,9 +45,10 @@
|
|
|
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
|
-
"ts-luxon": "^6.0.0"
|
|
50
|
+
"ts-luxon": "^6.0.0",
|
|
51
|
+
"zod": "^3.24.4"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@aws-sdk/client-dynamodb": "^3.758.0",
|
|
@@ -76,7 +77,8 @@
|
|
|
76
77
|
"tslib": "^2.8.1",
|
|
77
78
|
"tsup": "^8.4.0",
|
|
78
79
|
"typescript": "~5.8.2",
|
|
79
|
-
"typescript-eslint": "^8.32.0"
|
|
80
|
+
"typescript-eslint": "^8.32.0",
|
|
81
|
+
"zod": "^3.24.4"
|
|
80
82
|
},
|
|
81
83
|
"packageManager": "yarn@4.3.1"
|
|
82
84
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/utils/smp-gcpsid-raw.interface.ts"],"sourcesContent":["export interface SmpSidRaw {\n expiry: number;\n value: string;\n}\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["smp_gcpsid_raw_interface_exports","__toCommonJS"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-EI7MMDWY.js";import{catchError as i,throwError as p}from"rxjs";function f(n,o){return c=>c.pipe(i(r=>r instanceof n?o(r):p(()=>r)))}t(f,"smpRxjsCatchOnly");export{f as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-EI7MMDWY.js";var s=class{static{r(this,"SmpBrowserCache")}_storage;_prefix;constructor(t,e){this._storage=t,this._prefix=e}flush(){Object.keys(this._storage).filter(t=>t.startsWith(this._prefix)).forEach(this.remove.bind(this))}read(t){let e=this._storage.getItem(this._prefix+t);try{return e?JSON.parse(e):void 0}catch{return}}remove(t){this._storage.removeItem(this._prefix+t)}write(t,e){this._storage.setItem(this._prefix+t,JSON.stringify(e))}};export{s as 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 e}from"./chunk-EI7MMDWY.js";var s=class{static{e(this,"SmpInMemoryCache")}static _storage=new Map;get staticStorage(){return this.constructor._storage}flush(){this.staticStorage.clear()}read(t){return this.staticStorage.get(t)}remove(t){this.staticStorage.delete(t)}write(t,r){this.staticStorage.set(t,r)}};export{s 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
|
|
File without changes
|