@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.
Files changed (105) hide show
  1. package/changelog.md +13 -1
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +17 -8
  5. package/dist/cjs/services/http/index.cjs +1 -1
  6. package/dist/cjs/services/http/index.cjs.map +1 -1
  7. package/dist/cjs/services/http/index.d.cts +3 -4
  8. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -1
  9. package/dist/cjs/services/http/smp-http.service.cjs +1 -1
  10. package/dist/cjs/services/http/smp-http.service.cjs.map +1 -1
  11. package/dist/cjs/services/http/smp-http.service.d.cts +6 -3
  12. package/dist/cjs/services/index.cjs +1 -1
  13. package/dist/cjs/services/index.cjs.map +1 -1
  14. package/dist/cjs/services/index.d.cts +3 -4
  15. package/dist/cjs/shared/api/index.cjs +1 -1
  16. package/dist/cjs/shared/api/index.cjs.map +1 -1
  17. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs +1 -1
  18. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs.map +1 -1
  19. package/dist/cjs/shared/giftcard/index.cjs +1 -1
  20. package/dist/cjs/shared/giftcard/index.cjs.map +1 -1
  21. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs +1 -1
  22. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +1 -1
  23. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.d.cts +1 -1
  24. package/dist/cjs/shared/marketing-cloud/index.d.cts +1 -1
  25. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs.map +1 -1
  26. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.cts +4 -4
  27. package/dist/cjs/shared/rxjs/index.cjs +1 -1
  28. package/dist/cjs/shared/rxjs/index.cjs.map +1 -1
  29. package/dist/cjs/shared/rxjs/index.d.cts +3 -0
  30. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map +1 -1
  31. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +1 -1
  32. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +1 -1
  33. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +3 -3
  34. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs +2 -0
  35. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs.map +1 -0
  36. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.d.cts +23 -0
  37. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs +2 -0
  38. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs.map +1 -0
  39. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.d.cts +11 -0
  40. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs.map +1 -1
  41. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.d.cts +3 -3
  42. package/dist/cjs/shared/utils/cache/index.cjs +1 -1
  43. package/dist/cjs/shared/utils/cache/index.cjs.map +1 -1
  44. package/dist/cjs/shared/utils/cache/index.d.cts +2 -3
  45. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -1
  46. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
  47. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
  48. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +1 -1
  49. package/dist/cjs/shared/utils/index.cjs +1 -1
  50. package/dist/cjs/shared/utils/index.cjs.map +1 -1
  51. package/dist/cjs/shared/utils/index.d.cts +4 -3
  52. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs +2 -0
  53. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs.map +1 -0
  54. package/dist/cjs/shared/utils/smp-apply-mixin.function.d.cts +5 -0
  55. package/dist/cjs/shared/utils/smp-sid.class.cjs.map +1 -1
  56. package/dist/esm/chunk-3TSDCOVH.js +1 -0
  57. package/dist/esm/chunk-C3LKT6AF.js +1 -0
  58. package/dist/esm/chunk-ENM3HAPF.js +1 -0
  59. package/dist/esm/chunk-JXXO4LSO.js +1 -0
  60. package/dist/esm/chunk-NVYQBLR6.js +1 -0
  61. package/dist/esm/chunk-Z3K5PNSB.js +1 -0
  62. package/dist/esm/chunk-ZKODHJSY.js +1 -0
  63. package/dist/esm/index.d.ts +8 -5
  64. package/dist/esm/index.js +1 -1
  65. package/dist/esm/services/http/index.d.ts +3 -4
  66. package/dist/esm/services/http/index.js +1 -1
  67. package/dist/esm/services/http/smp-http.service.d.ts +6 -3
  68. package/dist/esm/services/http/smp-http.service.js +1 -1
  69. package/dist/esm/services/index.d.ts +3 -4
  70. package/dist/esm/services/index.js +1 -1
  71. package/dist/esm/shared/api/index.js +1 -1
  72. package/dist/esm/shared/api/smp-api-common-utils.class.js +1 -1
  73. package/dist/esm/shared/giftcard/index.js +1 -1
  74. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.d.ts +1 -1
  75. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.js +1 -1
  76. package/dist/esm/shared/marketing-cloud/index.d.ts +1 -1
  77. package/dist/esm/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.ts +4 -4
  78. package/dist/esm/shared/rxjs/index.d.ts +3 -0
  79. package/dist/esm/shared/rxjs/index.js +1 -1
  80. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.d.ts +3 -3
  81. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.js +1 -1
  82. package/dist/esm/shared/rxjs/smp-rxjs-queue.function.d.ts +23 -0
  83. package/dist/esm/shared/rxjs/smp-rxjs-queue.function.js +1 -0
  84. package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.d.ts +11 -0
  85. package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.js +1 -0
  86. package/dist/esm/shared/rxjs/smp-rxjs-throw-on-condition.function.d.ts +3 -3
  87. package/dist/esm/shared/utils/cache/index.d.ts +2 -3
  88. package/dist/esm/shared/utils/cache/index.js +1 -1
  89. package/dist/esm/shared/utils/index.d.ts +4 -3
  90. package/dist/esm/shared/utils/index.js +1 -1
  91. package/dist/esm/shared/utils/smp-apply-mixin.function.d.ts +5 -0
  92. package/dist/esm/shared/utils/smp-apply-mixin.function.js +1 -0
  93. package/package.json +4 -1
  94. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs +0 -2
  95. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +0 -1
  96. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +0 -12
  97. package/dist/esm/chunk-3XWLMKWI.js +0 -1
  98. package/dist/esm/chunk-MD2DPFLF.js +0 -1
  99. package/dist/esm/chunk-T3P4NVTG.js +0 -0
  100. package/dist/esm/chunk-VPL2IMUA.js +0 -1
  101. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +0 -12
  102. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.js +0 -1
  103. /package/dist/esm/{chunk-6MJDU4CZ.js → chunk-DGUMFWCQ.js} +0 -0
  104. /package/dist/esm/{chunk-B3OEBKFG.js → chunk-PKEW426R.js} +0 -0
  105. /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-VPL2IMUA.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};
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 #KikGiftcardTransaction._AES_ENCODER.
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-VPL2IMUA.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
+ 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 { KikMarketingCloudValidationResponse, KikMarketingCloudValidationResponseKo, KikMarketingCloudValidationResponseOk } from './smp-marketing-cloud-validation-response.interface.js';
1
+ export { SmpMarketingCloudValidationResponse, SmpMarketingCloudValidationResponseKo, SmpMarketingCloudValidationResponseOk } from './smp-marketing-cloud-validation-response.interface.js';
2
2
  export { SmpMarketingCloudValidators } from './smp-marketing-cloud-validators.enum.js';
@@ -1,14 +1,14 @@
1
1
  import { SmpMarketingCloudValidators } from './smp-marketing-cloud-validators.enum.js';
2
2
 
3
- interface KikMarketingCloudValidationResponseOk {
3
+ interface SmpMarketingCloudValidationResponseOk {
4
4
  email: string;
5
5
  valid: true;
6
6
  }
7
- interface KikMarketingCloudValidationResponseKo {
7
+ interface SmpMarketingCloudValidationResponseKo {
8
8
  email: string;
9
9
  valid: boolean;
10
10
  failedValidation: SmpMarketingCloudValidators;
11
11
  }
12
- type KikMarketingCloudValidationResponse = KikMarketingCloudValidationResponseOk | KikMarketingCloudValidationResponseKo;
12
+ type SmpMarketingCloudValidationResponse = SmpMarketingCloudValidationResponseOk | SmpMarketingCloudValidationResponseKo;
13
13
 
14
- export type { KikMarketingCloudValidationResponse, KikMarketingCloudValidationResponseKo, KikMarketingCloudValidationResponseOk };
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-6MJDU4CZ.js";import{a as d}from"../../chunk-QWZP25QT.js";import{a as b}from"../../chunk-QW43DOPY.js";import{a}from"../../chunk-JFKLRHIQ.js";import{a as c}from"../../chunk-FLTR4ZY6.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import"../../chunk-EI7MMDWY.js";export{a as SmpAbstractRxjsTtlCacheStrategy,b as smpRxjsCatchOnly,c as smpRxjsThrowIfEmpty,d as smpRxjsThrowOnCondition};
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 KikRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {
6
+ declare class SmpRxjsInMemoryCache extends SmpAbstractRxjsTtlCacheStrategy {
7
7
  private static _storage;
8
- protected get _staticSelf(): typeof KikRxjsInMemoryCache;
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 { KikRxjsInMemoryCache };
15
+ export { SmpRxjsInMemoryCache };
@@ -1 +1 @@
1
- import{a}from"../../chunk-JFKLRHIQ.js";import"../../chunk-5VCNTUI6.js";import"../../chunk-DADFHUII.js";import{a as s}from"../../chunk-EI7MMDWY.js";import{defer as e,of as r}from"rxjs";var i=class extends a{static{s(this,"KikRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return e(()=>(this._staticSelf._storage.clear(),r(void 0)))}_readRaw(t){return e(()=>r(this._staticSelf._storage.get(t)))}_removeRaw(t){return e(()=>(this._staticSelf._storage.delete(t),r(void 0)))}_writeRaw(t,o){return e(()=>(this._staticSelf._storage.set(t,o),r(void 0)))}};export{i as KikRxjsInMemoryCache};
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 { kikRxjsThrowOnCondition } from "./path-to-your-file";
16
+ * import { smpRxjsThrowOnCondition } from "./path-to-your-file";
17
17
  *
18
18
  * const source$ = of(1, 5, -3, 7, 12).pipe(
19
- * kikRxjsThrowOnCondition(value => value >= 0, () => new Error("Value is less than 0")),
20
- * kikRxjsThrowOnCondition(value => value > 12, () => new Error("Value is lower than 12"))
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-B3OEBKFG.js";import"../../../chunk-EB55SS67.js";import"../../../chunk-FE4YONC4.js";import{a as e}from"../../../chunk-FAUAQNPB.js";import{a as d}from"../../../chunk-GALYBKBP.js";import{a as c}from"../../../chunk-3AFPQCOH.js";import{a as b}from"../../../chunk-5VCNTUI6.js";import{a}from"../../../chunk-DADFHUII.js";import"../../../chunk-EI7MMDWY.js";export{a as SmpAbstractCacheStrategy,c as SmpAbstractTtlCacheStrategy,d as SmpBrowserCache,e as SmpInMemoryCache,b as smpIsSmpCachedValue};
1
+ 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-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};
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,5 @@
1
+ import { SmpGenericConstructor } from '../common/smp-generic-constructor.type.js';
2
+
3
+ declare function smpApplyMixin<T extends SmpGenericConstructor>(derivedCtor: T, baseCtors: SmpGenericConstructor[]): void;
4
+
5
+ export { smpApplyMixin };
@@ -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.6.0",
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";