@tonysamperi/ts-mapi-core 1.6.0 → 1.7.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 +13 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +17 -8
- 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 +3 -4
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -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/http/smp-http.service.d.cts +6 -3
- package/dist/cjs/services/index.cjs +1 -1
- package/dist/cjs/services/index.cjs.map +1 -1
- package/dist/cjs/services/index.d.cts +3 -4
- 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-api-common-utils.class.cjs +1 -1
- package/dist/cjs/shared/api/smp-api-common-utils.class.cjs.map +1 -1
- package/dist/cjs/shared/giftcard/index.cjs +1 -1
- package/dist/cjs/shared/giftcard/index.cjs.map +1 -1
- package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs +1 -1
- package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +1 -1
- package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.d.cts +1 -1
- package/dist/cjs/shared/marketing-cloud/index.d.cts +1 -1
- package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs.map +1 -1
- package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.cts +4 -4
- 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.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +3 -3
- package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs +2 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs.map +1 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.d.cts +23 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs +2 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs.map +1 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.d.cts +11 -0
- package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.d.cts +3 -3
- 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 -3
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +1 -1
- 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 +4 -3
- package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs +2 -0
- package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs.map +1 -0
- package/dist/cjs/shared/utils/smp-apply-mixin.function.d.cts +5 -0
- package/dist/cjs/shared/utils/smp-sid.class.cjs.map +1 -1
- package/dist/esm/chunk-3TSDCOVH.js +1 -0
- package/dist/esm/chunk-C3LKT6AF.js +1 -0
- package/dist/esm/chunk-ENM3HAPF.js +1 -0
- package/dist/esm/chunk-JXXO4LSO.js +1 -0
- package/dist/esm/chunk-NVYQBLR6.js +1 -0
- package/dist/esm/chunk-Z3K5PNSB.js +1 -0
- package/dist/esm/chunk-ZKODHJSY.js +1 -0
- package/dist/esm/index.d.ts +8 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/services/http/index.d.ts +3 -4
- package/dist/esm/services/http/index.js +1 -1
- package/dist/esm/services/http/smp-http.service.d.ts +6 -3
- package/dist/esm/services/http/smp-http.service.js +1 -1
- package/dist/esm/services/index.d.ts +3 -4
- package/dist/esm/services/index.js +1 -1
- package/dist/esm/shared/api/index.js +1 -1
- package/dist/esm/shared/api/smp-api-common-utils.class.js +1 -1
- package/dist/esm/shared/giftcard/index.js +1 -1
- package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.d.ts +1 -1
- package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.js +1 -1
- package/dist/esm/shared/marketing-cloud/index.d.ts +1 -1
- package/dist/esm/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.ts +4 -4
- 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-rxjs-in-memory-cache.class.d.ts +3 -3
- package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.js +1 -1
- package/dist/esm/shared/rxjs/smp-rxjs-queue.function.d.ts +23 -0
- package/dist/esm/shared/rxjs/smp-rxjs-queue.function.js +1 -0
- package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.d.ts +11 -0
- package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.js +1 -0
- package/dist/esm/shared/rxjs/smp-rxjs-throw-on-condition.function.d.ts +3 -3
- package/dist/esm/shared/utils/cache/index.d.ts +2 -3
- package/dist/esm/shared/utils/cache/index.js +1 -1
- package/dist/esm/shared/utils/index.d.ts +4 -3
- package/dist/esm/shared/utils/index.js +1 -1
- package/dist/esm/shared/utils/smp-apply-mixin.function.d.ts +5 -0
- package/dist/esm/shared/utils/smp-apply-mixin.function.js +1 -0
- package/package.json +4 -1
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs +0 -2
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +0 -1
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +0 -12
- package/dist/esm/chunk-3XWLMKWI.js +0 -1
- package/dist/esm/chunk-MD2DPFLF.js +0 -1
- package/dist/esm/chunk-T3P4NVTG.js +0 -0
- package/dist/esm/chunk-VPL2IMUA.js +0 -1
- package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +0 -12
- package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.js +0 -1
- /package/dist/esm/{chunk-6MJDU4CZ.js → chunk-DGUMFWCQ.js} +0 -0
- /package/dist/esm/{chunk-B3OEBKFG.js → chunk-PKEW426R.js} +0 -0
- /package/dist/esm/{chunk-FE4YONC4.js → chunk-SZM4WHQJ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-HOM5S5W3.js";import"../../chunk-ZYPNYJVE.js";import"../../chunk-BHFFGFHY.js";import{a as c}from"../../chunk-
|
|
1
|
+
import"../../chunk-HOM5S5W3.js";import"../../chunk-ZYPNYJVE.js";import"../../chunk-BHFFGFHY.js";import{a as c}from"../../chunk-3TSDCOVH.js";import{a as b}from"../../chunk-U4GEYICC.js";import{a}from"../../chunk-5XYURNIE.js";import"../../chunk-S7DRNW2X.js";import"../../chunk-XZEYUIQ6.js";import"../../chunk-EI7MMDWY.js";export{c as SmpGiftcardTransaction,b as SmpGiftcardTransactionHashStrategies,a as SmpGiftcardTransactionOps};
|
|
@@ -7,7 +7,7 @@ import { SmpGiftcardTransactionConfig } from './smp-giftcard-transaction-config.
|
|
|
7
7
|
import { SmpGiftcardTransactionHashStrategies } from './smp-giftcard-transaction-hash-strategies.enum.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Base implementation that you can extend, even customizing the static parts like #
|
|
10
|
+
* Base implementation that you can extend, even customizing the static parts like #SmpGiftcardTransaction._AES_ENCODER.
|
|
11
11
|
* You can create your own instance of KikAesCrypt to override it.
|
|
12
12
|
*/
|
|
13
13
|
declare class SmpGiftcardTransaction implements SmpGiftcardTransactionPlain {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-3TSDCOVH.js";import"../../chunk-U4GEYICC.js";import"../../chunk-5XYURNIE.js";import"../../chunk-S7DRNW2X.js";import"../../chunk-XZEYUIQ6.js";import"../../chunk-EI7MMDWY.js";export{a as SmpGiftcardTransaction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SmpMarketingCloudValidationResponse, SmpMarketingCloudValidationResponseKo, SmpMarketingCloudValidationResponseOk } from './smp-marketing-cloud-validation-response.interface.js';
|
|
2
2
|
export { SmpMarketingCloudValidators } from './smp-marketing-cloud-validators.enum.js';
|
package/dist/esm/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SmpMarketingCloudValidators } from './smp-marketing-cloud-validators.enum.js';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface SmpMarketingCloudValidationResponseOk {
|
|
4
4
|
email: string;
|
|
5
5
|
valid: true;
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
7
|
+
interface SmpMarketingCloudValidationResponseKo {
|
|
8
8
|
email: string;
|
|
9
9
|
valid: boolean;
|
|
10
10
|
failedValidation: SmpMarketingCloudValidators;
|
|
11
11
|
}
|
|
12
|
-
type
|
|
12
|
+
type SmpMarketingCloudValidationResponse = SmpMarketingCloudValidationResponseOk | SmpMarketingCloudValidationResponseKo;
|
|
13
13
|
|
|
14
|
-
export type {
|
|
14
|
+
export type { SmpMarketingCloudValidationResponse, SmpMarketingCloudValidationResponseKo, SmpMarketingCloudValidationResponseOk };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-strategy.class.js';
|
|
2
2
|
export { smpRxjsCatchOnly } from './smp-rxjs-catch-only.function.js';
|
|
3
|
+
export { SmpRxjsInMemoryCache } from './smp-rxjs-in-memory-cache.class.js';
|
|
4
|
+
export { smpRxjsQueue } from './smp-rxjs-queue.function.js';
|
|
5
|
+
export { smpRxjsSequence } from './smp-rxjs-sequence.function.js';
|
|
3
6
|
export { smpRxjsThrowIfEmpty } from './smp-rxjs-throw-if-empty.function.js';
|
|
4
7
|
export { smpRxjsThrowOnCondition } from './smp-rxjs-throw-on-condition.function.js';
|
|
5
8
|
import 'rxjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-
|
|
1
|
+
import"../../chunk-SZM4WHQJ.js";import{a as e}from"../../chunk-JXXO4LSO.js";import{a as g}from"../../chunk-QWZP25QT.js";import{a as f}from"../../chunk-FLTR4ZY6.js";import{a as b}from"../../chunk-QW43DOPY.js";import{a as c}from"../../chunk-NVYQBLR6.js";import{a}from"../../chunk-JFKLRHIQ.js";import{a as d}from"../../chunk-Z3K5PNSB.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpAbstractRxjsTtlCacheStrategy,c as SmpRxjsInMemoryCache,b as smpRxjsCatchOnly,d as smpRxjsQueue,e as smpRxjsSequence,f as smpRxjsThrowIfEmpty,g as smpRxjsThrowOnCondition};
|
|
@@ -3,13 +3,13 @@ import { SmpAbstractRxjsTtlCacheStrategy } from './smp-abstract-rxjs-ttl-cache-s
|
|
|
3
3
|
import '../utils/cache/smp-abstract-cache-strategy.class.js';
|
|
4
4
|
import '../utils/cache/smp-cached-value.interface.js';
|
|
5
5
|
|
|
6
|
-
declare class
|
|
6
|
+
declare class SmpRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {
|
|
7
7
|
private static _storage;
|
|
8
|
-
protected get _staticSelf(): typeof
|
|
8
|
+
protected get _staticSelf(): typeof SmpRxjsInMemoryCache;
|
|
9
9
|
protected _flushRaw(): Observable<void>;
|
|
10
10
|
protected _readRaw(key: string): Observable<unknown | undefined>;
|
|
11
11
|
protected _removeRaw(key: string): Observable<void>;
|
|
12
12
|
protected _writeRaw(key: string, value: unknown): Observable<void>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { SmpRxjsInMemoryCache };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-JFKLRHIQ.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import
|
|
1
|
+
import{a}from"../../chunk-NVYQBLR6.js";import"../../chunk-JFKLRHIQ.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpRxjsInMemoryCache};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
type ObsFnMap = Record<string, () => Observable<any>>;
|
|
4
|
+
/**
|
|
5
|
+
* Processes a queue of RxJS Observables sequentially, either as an array or a mapped object.
|
|
6
|
+
*
|
|
7
|
+
* @param {(() => Observable<T>)[] | Record<string, () => Observable<T>>} source
|
|
8
|
+
* A source of Observables to be processed in sequence. It can either be:
|
|
9
|
+
* - An array of functions returning Observables.
|
|
10
|
+
* - An object where keys are mapped to functions returning Observables.
|
|
11
|
+
*
|
|
12
|
+
* @return {Observable<any>}
|
|
13
|
+
* An Observable that emits the combined results of the processed Observables. If the input is an array,
|
|
14
|
+
* the output is an array of results. If the input is an object, the output is an object with the same keys containing the results.
|
|
15
|
+
*/
|
|
16
|
+
declare function smpRxjsQueue<T extends (() => Observable<any>)[]>(source: T): Observable<{
|
|
17
|
+
[K in keyof T]: T[K] extends () => Observable<infer U> ? U : never;
|
|
18
|
+
}>;
|
|
19
|
+
declare function smpRxjsQueue<T extends ObsFnMap>(source: T): Observable<{
|
|
20
|
+
[K in keyof T]: T[K] extends () => Observable<infer U> ? U : never;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
export { smpRxjsQueue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-Z3K5PNSB.js";import"../../chunk-EI7MMDWY.js";export{a as smpRxjsQueue};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Old version of the sequence. Now rewritten using recursion, which is way faster.
|
|
5
|
+
* But you can use this if you want to stick with the rxjs pattern.
|
|
6
|
+
* Use smpRxjsQueue for better performance ;)
|
|
7
|
+
* @param steps
|
|
8
|
+
*/
|
|
9
|
+
declare function smpRxjsSequence<T = any>(steps: (() => Observable<T>)[]): Observable<T[]>;
|
|
10
|
+
|
|
11
|
+
export { smpRxjsSequence };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-JXXO4LSO.js";import"../../chunk-EI7MMDWY.js";export{a as smpRxjsSequence};
|
|
@@ -13,11 +13,11 @@ import { OperatorFunction } from 'rxjs';
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* import { of } from 'rxjs';
|
|
16
|
-
* import {
|
|
16
|
+
* import { smpRxjsThrowOnCondition } from "./path-to-your-file";
|
|
17
17
|
*
|
|
18
18
|
* const source$ = of(1, 5, -3, 7, 12).pipe(
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* smpRxjsThrowOnCondition(value => value >= 0, () => new Error("Value is less than 0")),
|
|
20
|
+
* smpRxjsThrowOnCondition(value => value > 12, () => new Error("Value is lower than 12"))
|
|
21
21
|
* );
|
|
22
22
|
*
|
|
23
23
|
* source$.subscribe({
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { SmpBrowserCache } from './smp-browser-cache.class.js';
|
|
2
|
-
export { SmpCacheStrategy } from './smp-cache-strategy.interface.js';
|
|
3
|
-
export { SmpCachedValue } from './smp-cached-value.interface.js';
|
|
4
1
|
export { SmpAbstractCacheStrategy } from './smp-abstract-cache-strategy.class.js';
|
|
5
2
|
export { SmpAbstractTtlCacheStrategy } from './smp-abstract-ttl-cache-strategy.class.js';
|
|
3
|
+
export { SmpBrowserCache } from './smp-browser-cache.class.js';
|
|
4
|
+
export { SmpCachedValue } from './smp-cached-value.interface.js';
|
|
6
5
|
export { SmpInMemoryCache } from './smp-in-memory-cache.class.js';
|
|
7
6
|
export { smpIsSmpCachedValue } from './smp-is-smp-cached-value.function.js';
|
|
8
7
|
import 'rxjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../chunk-
|
|
1
|
+
import"../../../chunk-DGUMFWCQ.js";import"../../../chunk-EB55SS67.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,14 +1,15 @@
|
|
|
1
|
+
export { smpApplyMixin } from './smp-apply-mixin.function.js';
|
|
1
2
|
export { SmpCommonUtils } from './smp-common-utils.class.js';
|
|
2
3
|
export { SmpFilterException } from './smp-filter-exception.class.js';
|
|
3
4
|
export { SmpSid } from './smp-sid.class.js';
|
|
4
5
|
export { smpNoop } from './smp-noop.function.js';
|
|
5
6
|
export { SmpRegularExpressions } from './smp-regular-expressions.class.js';
|
|
6
|
-
export { SmpBrowserCache } from './cache/smp-browser-cache.class.js';
|
|
7
|
-
export { SmpCacheStrategy } from './cache/smp-cache-strategy.interface.js';
|
|
8
|
-
export { SmpCachedValue } from './cache/smp-cached-value.interface.js';
|
|
9
7
|
export { SmpAbstractCacheStrategy } from './cache/smp-abstract-cache-strategy.class.js';
|
|
10
8
|
export { SmpAbstractTtlCacheStrategy } from './cache/smp-abstract-ttl-cache-strategy.class.js';
|
|
9
|
+
export { SmpBrowserCache } from './cache/smp-browser-cache.class.js';
|
|
10
|
+
export { SmpCachedValue } from './cache/smp-cached-value.interface.js';
|
|
11
11
|
export { SmpInMemoryCache } from './cache/smp-in-memory-cache.class.js';
|
|
12
12
|
export { smpIsSmpCachedValue } from './cache/smp-is-smp-cached-value.function.js';
|
|
13
|
+
import '../common/smp-generic-constructor.type.js';
|
|
13
14
|
import '../api/smp-rest-verbs.enum.js';
|
|
14
15
|
import 'rxjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-
|
|
1
|
+
import"../../chunk-PKEW426R.js";import"../../chunk-NIN4PUZX.js";import{a as k}from"../../chunk-RGLXAD7B.js";import{a as j}from"../../chunk-MMNEY2JK.js";import"../../chunk-DGUMFWCQ.js";import"../../chunk-EB55SS67.js";import{a as g}from"../../chunk-ZKODHJSY.js";import{a as h}from"../../chunk-DTVHTARR.js";import"../../chunk-DOKJQH4K.js";import"../../chunk-R6VG4656.js";import{a as i}from"../../chunk-4UTF5FWK.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,h as SmpCommonUtils,i as SmpFilterException,e as SmpInMemoryCache,k as SmpRegularExpressions,j as SmpSid,g as smpApplyMixin,b as smpIsSmpCachedValue,f as smpNoop};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-ZKODHJSY.js";import"../../chunk-EI7MMDWY.js";export{a as smpApplyMixin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonysamperi/ts-mapi-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.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",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"build:dev": "NODE_ENV=development node build.config",
|
|
33
33
|
"build": "NODE_ENV=production node build.config",
|
|
34
34
|
"build:cjs": "webpack --config webpack.cjs.config.cjs --stats verbose",
|
|
35
|
+
"check-exports": "node scripts/check-exports.js",
|
|
35
36
|
"lint": "eslint && tsc --noEmit",
|
|
37
|
+
"prepublishOnly": "npm run build && npm run check-exports",
|
|
36
38
|
"release": "npm publish",
|
|
37
39
|
"release:beta": "npm publish --tag beta",
|
|
38
40
|
"release:next": "npm publish --tag next",
|
|
@@ -67,6 +69,7 @@
|
|
|
67
69
|
"class-transformer": "^0.5.1",
|
|
68
70
|
"eslint": "^9.26.0",
|
|
69
71
|
"firebase": "^11.4.0",
|
|
72
|
+
"glob": "^11.0.3",
|
|
70
73
|
"jest": "~29.7.0",
|
|
71
74
|
"reflect-metadata": "^0.1.14",
|
|
72
75
|
"replace-in-file": "^8.3.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(o,e,x,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of b(e))!c.call(o,p)&&p!==x&&t(o,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return o};var f=o=>d(t({},"__esModule",{value:!0}),o);var g={};module.exports=f(g);
|
|
2
|
-
//# sourceMappingURL=smp-cache-strategy.interface.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/shared/utils/cache/smp-cache-strategy.interface.ts"],"sourcesContent":["/**\n * @depcrecated use KikAbstractCacheStrategy instead.\n * This entity will be removed in the next major version.\n */\nexport interface SmpCacheStrategy {\n read<T = unknown>(key: string): T | undefined;\n\n write<T = unknown>(key: string, value: T): void;\n\n remove(key: string): void;\n\n flush(): void;\n}\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["smp_cache_strategy_interface_exports","__toCommonJS"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @depcrecated use KikAbstractCacheStrategy instead.
|
|
3
|
-
* This entity will be removed in the next major version.
|
|
4
|
-
*/
|
|
5
|
-
interface SmpCacheStrategy {
|
|
6
|
-
read<T = unknown>(key: string): T | undefined;
|
|
7
|
-
write<T = unknown>(key: string, value: T): void;
|
|
8
|
-
remove(key: string): void;
|
|
9
|
-
flush(): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type { SmpCacheStrategy };
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as s}from"./chunk-RCI7NEJO.js";import{a as i}from"./chunk-EI7MMDWY.js";var o=class{static{i(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new s;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,c)=>{let a=t[c];return a!==void 0?encodeURIComponent(a):r})}catch(r){this._logger.warn("KikApiCommonUtils: couldn't interpolate params",r)}return e}};export{o as a};
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-U4GEYICC.js";import{a as o}from"./chunk-5XYURNIE.js";import{a as m}from"./chunk-S7DRNW2X.js";import{b as f,d as _,g as u,j as A,k as S}from"./chunk-XZEYUIQ6.js";import{a as h}from"./chunk-EI7MMDWY.js";import{Expose as d,instanceToPlain as g,plainToInstance as C}from"class-transformer";import{DateTime as E}from"ts-luxon";function R(a,t,e,r){var i=arguments.length,s=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(a,t,e,r);else for(var p=a.length-1;p>=0;p--)(n=a[p])&&(s=(i<3?n(s):i>3?n(t,e,s):n(t,e))||s);return i>3&&s&&Object.defineProperty(t,e,s),s}h(R,"_ts_decorate");function O(a,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(a,t)}h(O,"_ts_metadata");var l=class{static{h(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new m("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[o.CHECK]:"",[o.TRANSACTION]:"",[o.TRANSACTION_DETAIL]:"",[o.ACTIVATE]:"A",[o.BLOCK]:"B",[o.DIGITAL_ACTIVATE]:"D",[o.FREEZE]:"F",[o.PURCHASE]:"P",[o.RECHARGE]:"G",[o.ROLLBACK]:"R",[o.UNFREEZE]:"U",[o.XREFUND]:"X"};static _SEP="_";get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}_dto;_hashStrategies;_hashStrategy;constructor(t="ACTIVATION",e,r,i){this.gc=t,this.op=e,this.ot=r,this._hashStrategies={[c.MD5]:s=>A(s),[c.MD5_HMAC]:s=>{let n=new _;return n.update(f.parse(s)),n.finalize()},[c.SHA1]:s=>S(s),[c.SHA1_HMAC]:s=>{let n=new u;return n.update(f.parse(s)),n.finalize()}},this._hashStrategy=this._hashStrategies[c.MD5],this._dto=typeof i=="number"&&i>=0?E.fromMillis(+`${i}000`.slice(0,13)):E.local()}static build({gc:t,op:e,ot:r,dto:i}){return new this(t,e,r,i?.ts)}static explode(t){let e=this.constructor,r=(t||"").split(e._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${t}"`);return this.build({gc:r[1],op:e.prefixToOperation(r[2]),dto:E.fromSeconds(+r[3])})}static isBase64(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)&&t.length%4===0}static parse(t){this._LOGGER.info(`${this.constructor.name}: trying to parse ${t}`);try{if(this.isBase64(t)){let e=this.constructor._AES_ENCODER.decryptAES(t),r=JSON.parse(e);return C(this,r)}else return this.explode(t)}catch(e){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${t}`,e),new Error(`UNPARSEABLE "${t}"`)}}static prefixToOperation(t){return Object.entries(this._OP_CODES).find(([,r])=>r===t)[0]}serialize(){return g(this,{excludePrefixes:["_"]})}toString(){let t=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(t)}};R([d(),O("design:type",Number),O("design:paramtypes",[])],l.prototype,"ts",null);export{l as a};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @depcrecated use KikAbstractCacheStrategy instead.
|
|
3
|
-
* This entity will be removed in the next major version.
|
|
4
|
-
*/
|
|
5
|
-
interface SmpCacheStrategy {
|
|
6
|
-
read<T = unknown>(key: string): T | undefined;
|
|
7
|
-
write<T = unknown>(key: string, value: T): void;
|
|
8
|
-
remove(key: string): void;
|
|
9
|
-
flush(): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type { SmpCacheStrategy };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../../chunk-FE4YONC4.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|