@elliemae/pui-app-sdk 5.16.3 → 5.17.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/dist/cjs/index.js CHANGED
@@ -79,6 +79,7 @@ __export(lib_exports, {
79
79
  configureStore: () => import_store.createAppStore,
80
80
  createManager: () => import_redux_injectors.createManager,
81
81
  createSideEffect: () => import_listenerMiddleware.createSideEffect,
82
+ decorators: () => import_decorators.decorators,
82
83
  enableReactAppForHostIntegration: () => import_react2.enableReactAppForHostIntegration,
83
84
  endSession: () => import_auth.endSession,
84
85
  error: () => import_error.actions,
@@ -167,6 +168,7 @@ var import_react = require("./data/react.js");
167
168
  var import_use_state_selector = require("./utils/custom-hooks/use-state-selector.js");
168
169
  var import_errorMiddleware = require("./data/errorMiddleware.js");
169
170
  var import_listenerMiddleware = require("./data/listenerMiddleware.js");
171
+ var import_decorators = require("./utils/decorators");
170
172
  var import_helper = require("./utils/auth/helper.js");
171
173
  var import_url = require("./utils/url.js");
172
174
  var import_store = require("./data/store.js");
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var classDecorators_exports = {};
20
+ __export(classDecorators_exports, {
21
+ Mixins: () => Mixins,
22
+ Singleton: () => Singleton
23
+ });
24
+ module.exports = __toCommonJS(classDecorators_exports);
25
+ function Mixins(...constructors) {
26
+ return (derivedCtor) => {
27
+ constructors.forEach((baseCtor) => {
28
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
29
+ Object.defineProperty(
30
+ derivedCtor.prototype,
31
+ name,
32
+ Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
33
+ );
34
+ });
35
+ Object.getOwnPropertyNames(baseCtor).forEach((name) => {
36
+ if (name !== "prototype" && name !== "name" && name !== "length") {
37
+ Object.defineProperty(
38
+ derivedCtor,
39
+ name,
40
+ Object.getOwnPropertyDescriptor(baseCtor, name) || /* @__PURE__ */ Object.create(null)
41
+ );
42
+ }
43
+ });
44
+ });
45
+ };
46
+ }
47
+ const SINGLETON_KEY = Symbol("singleton");
48
+ function Singleton(type) {
49
+ return new Proxy(type, {
50
+ construct(target, argsList, newTarget) {
51
+ if (target.prototype !== newTarget.prototype) {
52
+ return Reflect.construct(target, argsList, newTarget);
53
+ }
54
+ if (!target[SINGLETON_KEY]) {
55
+ target[SINGLETON_KEY] = Reflect.construct(target, argsList, newTarget);
56
+ }
57
+ return target[SINGLETON_KEY];
58
+ }
59
+ });
60
+ }
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var functionDecorators_exports = {};
20
+ __export(functionDecorators_exports, {
21
+ CacheUntilResolved: () => CacheUntilResolved,
22
+ Debounce: () => Debounce,
23
+ ImmutableArgs: () => ImmutableArgs,
24
+ Memoize: () => Memoize,
25
+ MemoizeAsync: () => MemoizeAsync,
26
+ QueueTask: () => QueueTask,
27
+ Throttle: () => Throttle
28
+ });
29
+ module.exports = __toCommonJS(functionDecorators_exports);
30
+ function CacheUntilResolved(_target, propertyKey, descriptor) {
31
+ const promiseMap = /* @__PURE__ */ new Map();
32
+ const originalMethod = descriptor.value;
33
+ descriptor.value = function(...args) {
34
+ const key = `${propertyKey}_${JSON.stringify(args)}`;
35
+ if (promiseMap.has(key)) {
36
+ return promiseMap.get(key);
37
+ }
38
+ const resultPromise = originalMethod.apply(this, args);
39
+ promiseMap.set(key, resultPromise);
40
+ resultPromise.finally(() => {
41
+ promiseMap.delete(key);
42
+ });
43
+ return resultPromise;
44
+ };
45
+ return descriptor;
46
+ }
47
+ function Debounce(delay = 300) {
48
+ return function(_target, _propertyKey, descriptor) {
49
+ const originalMethod = descriptor.value;
50
+ let timeoutId;
51
+ descriptor.value = function(...args) {
52
+ if (timeoutId) {
53
+ clearTimeout(timeoutId);
54
+ }
55
+ timeoutId = window.setTimeout(() => {
56
+ originalMethod.apply(this, args);
57
+ }, delay);
58
+ };
59
+ return descriptor;
60
+ };
61
+ }
62
+ function ImmutableArgs(_target, _propertyKey, descriptor) {
63
+ const originalMethod = descriptor.value;
64
+ descriptor.value = function(...args) {
65
+ const changedArgs = args.map((arg) => {
66
+ if (arg && typeof arg === "object") {
67
+ arg = JSON.parse(JSON.stringify(arg));
68
+ }
69
+ return arg;
70
+ });
71
+ return originalMethod.apply(this, changedArgs);
72
+ };
73
+ return descriptor;
74
+ }
75
+ function Memoize(_target, _key, descriptor) {
76
+ const originalMethod = descriptor.value;
77
+ const cache = /* @__PURE__ */ new Map();
78
+ descriptor.value = function value(...args) {
79
+ const key = JSON.stringify(args);
80
+ if (cache.has(key)) {
81
+ return cache.get(key);
82
+ }
83
+ const result = originalMethod.call(this, ...args);
84
+ cache.set(key, result);
85
+ return result;
86
+ };
87
+ }
88
+ function MemoizeAsync(_target, _propertyKey, descriptor) {
89
+ const originalMethod = descriptor.value || descriptor.get;
90
+ const cache = /* @__PURE__ */ new Map();
91
+ if (typeof originalMethod !== "function") {
92
+ throw new Error("Decorator can only be applied to methods or getters");
93
+ }
94
+ if (descriptor.value) {
95
+ descriptor.value = async function(...args) {
96
+ const cacheKey = JSON.stringify(args);
97
+ if (cache.has(cacheKey)) {
98
+ return cache.get(cacheKey);
99
+ }
100
+ const resultPromise = originalMethod.apply(this, args);
101
+ cache.set(cacheKey, resultPromise);
102
+ try {
103
+ const result = await resultPromise;
104
+ return result;
105
+ } catch (error) {
106
+ cache.delete(cacheKey);
107
+ throw error;
108
+ }
109
+ };
110
+ } else if (descriptor.get) {
111
+ descriptor.get = async function() {
112
+ const cacheKey = "getter";
113
+ if (cache.has(cacheKey)) {
114
+ return cache.get(cacheKey);
115
+ }
116
+ const resultPromise = originalMethod.apply(this);
117
+ cache.set(cacheKey, resultPromise);
118
+ try {
119
+ const result = await resultPromise;
120
+ return result;
121
+ } catch (error) {
122
+ cache.delete(cacheKey);
123
+ throw error;
124
+ }
125
+ };
126
+ }
127
+ return descriptor;
128
+ }
129
+ function QueueTask(_target, _key, descriptor) {
130
+ const originalMethod = descriptor.value;
131
+ descriptor.value = function value(...args) {
132
+ queueMicrotask(() => {
133
+ originalMethod.call(this, ...args);
134
+ });
135
+ };
136
+ }
137
+ function Throttle(delay = 300) {
138
+ let lastCall = 0;
139
+ return function(_target, _propertyKey, descriptor) {
140
+ const originalMethod = descriptor.value;
141
+ descriptor.value = function(...args) {
142
+ const now = Date.now();
143
+ if (now - lastCall >= delay) {
144
+ lastCall = now;
145
+ originalMethod.apply(this, args);
146
+ }
147
+ };
148
+ return descriptor;
149
+ };
150
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var decorators_exports = {};
20
+ __export(decorators_exports, {
21
+ decorators: () => decorators
22
+ });
23
+ module.exports = __toCommonJS(decorators_exports);
24
+ var import_classDecorators = require("./classDecorators");
25
+ var import_functionDecorators = require("./functionDecorators");
26
+ const decorators = {
27
+ class: {
28
+ Mixins: import_classDecorators.Mixins,
29
+ Singleton: import_classDecorators.Singleton
30
+ },
31
+ function: {
32
+ CacheUntilResolved: import_functionDecorators.CacheUntilResolved,
33
+ Debounce: import_functionDecorators.Debounce,
34
+ ImmutableArgs: import_functionDecorators.ImmutableArgs,
35
+ Memoize: import_functionDecorators.Memoize,
36
+ MemoizeAsync: import_functionDecorators.MemoizeAsync,
37
+ QueueTask: import_functionDecorators.QueueTask,
38
+ Throttle: import_functionDecorators.Throttle
39
+ }
40
+ };
package/dist/esm/index.js CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  removeSideEffect,
42
42
  clearSideEffects
43
43
  } from "./data/listenerMiddleware.js";
44
+ import { decorators } from "./utils/decorators";
44
45
  import { getAuthorizationHeader } from "./utils/auth/helper.js";
45
46
  import { getRedirectUrl, removeDoubleSlash } from "./utils/url.js";
46
47
  import { createAppStore } from "./data/store.js";
@@ -191,6 +192,7 @@ export {
191
192
  createAppStore as configureStore,
192
193
  createManager,
193
194
  createSideEffect,
195
+ decorators,
194
196
  enableReactAppForHostIntegration,
195
197
  endSession,
196
198
  actions2 as error,
@@ -0,0 +1,40 @@
1
+ function Mixins(...constructors) {
2
+ return (derivedCtor) => {
3
+ constructors.forEach((baseCtor) => {
4
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
5
+ Object.defineProperty(
6
+ derivedCtor.prototype,
7
+ name,
8
+ Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
9
+ );
10
+ });
11
+ Object.getOwnPropertyNames(baseCtor).forEach((name) => {
12
+ if (name !== "prototype" && name !== "name" && name !== "length") {
13
+ Object.defineProperty(
14
+ derivedCtor,
15
+ name,
16
+ Object.getOwnPropertyDescriptor(baseCtor, name) || /* @__PURE__ */ Object.create(null)
17
+ );
18
+ }
19
+ });
20
+ });
21
+ };
22
+ }
23
+ const SINGLETON_KEY = Symbol("singleton");
24
+ function Singleton(type) {
25
+ return new Proxy(type, {
26
+ construct(target, argsList, newTarget) {
27
+ if (target.prototype !== newTarget.prototype) {
28
+ return Reflect.construct(target, argsList, newTarget);
29
+ }
30
+ if (!target[SINGLETON_KEY]) {
31
+ target[SINGLETON_KEY] = Reflect.construct(target, argsList, newTarget);
32
+ }
33
+ return target[SINGLETON_KEY];
34
+ }
35
+ });
36
+ }
37
+ export {
38
+ Mixins,
39
+ Singleton
40
+ };
@@ -0,0 +1,130 @@
1
+ function CacheUntilResolved(_target, propertyKey, descriptor) {
2
+ const promiseMap = /* @__PURE__ */ new Map();
3
+ const originalMethod = descriptor.value;
4
+ descriptor.value = function(...args) {
5
+ const key = `${propertyKey}_${JSON.stringify(args)}`;
6
+ if (promiseMap.has(key)) {
7
+ return promiseMap.get(key);
8
+ }
9
+ const resultPromise = originalMethod.apply(this, args);
10
+ promiseMap.set(key, resultPromise);
11
+ resultPromise.finally(() => {
12
+ promiseMap.delete(key);
13
+ });
14
+ return resultPromise;
15
+ };
16
+ return descriptor;
17
+ }
18
+ function Debounce(delay = 300) {
19
+ return function(_target, _propertyKey, descriptor) {
20
+ const originalMethod = descriptor.value;
21
+ let timeoutId;
22
+ descriptor.value = function(...args) {
23
+ if (timeoutId) {
24
+ clearTimeout(timeoutId);
25
+ }
26
+ timeoutId = window.setTimeout(() => {
27
+ originalMethod.apply(this, args);
28
+ }, delay);
29
+ };
30
+ return descriptor;
31
+ };
32
+ }
33
+ function ImmutableArgs(_target, _propertyKey, descriptor) {
34
+ const originalMethod = descriptor.value;
35
+ descriptor.value = function(...args) {
36
+ const changedArgs = args.map((arg) => {
37
+ if (arg && typeof arg === "object") {
38
+ arg = JSON.parse(JSON.stringify(arg));
39
+ }
40
+ return arg;
41
+ });
42
+ return originalMethod.apply(this, changedArgs);
43
+ };
44
+ return descriptor;
45
+ }
46
+ function Memoize(_target, _key, descriptor) {
47
+ const originalMethod = descriptor.value;
48
+ const cache = /* @__PURE__ */ new Map();
49
+ descriptor.value = function value(...args) {
50
+ const key = JSON.stringify(args);
51
+ if (cache.has(key)) {
52
+ return cache.get(key);
53
+ }
54
+ const result = originalMethod.call(this, ...args);
55
+ cache.set(key, result);
56
+ return result;
57
+ };
58
+ }
59
+ function MemoizeAsync(_target, _propertyKey, descriptor) {
60
+ const originalMethod = descriptor.value || descriptor.get;
61
+ const cache = /* @__PURE__ */ new Map();
62
+ if (typeof originalMethod !== "function") {
63
+ throw new Error("Decorator can only be applied to methods or getters");
64
+ }
65
+ if (descriptor.value) {
66
+ descriptor.value = async function(...args) {
67
+ const cacheKey = JSON.stringify(args);
68
+ if (cache.has(cacheKey)) {
69
+ return cache.get(cacheKey);
70
+ }
71
+ const resultPromise = originalMethod.apply(this, args);
72
+ cache.set(cacheKey, resultPromise);
73
+ try {
74
+ const result = await resultPromise;
75
+ return result;
76
+ } catch (error) {
77
+ cache.delete(cacheKey);
78
+ throw error;
79
+ }
80
+ };
81
+ } else if (descriptor.get) {
82
+ descriptor.get = async function() {
83
+ const cacheKey = "getter";
84
+ if (cache.has(cacheKey)) {
85
+ return cache.get(cacheKey);
86
+ }
87
+ const resultPromise = originalMethod.apply(this);
88
+ cache.set(cacheKey, resultPromise);
89
+ try {
90
+ const result = await resultPromise;
91
+ return result;
92
+ } catch (error) {
93
+ cache.delete(cacheKey);
94
+ throw error;
95
+ }
96
+ };
97
+ }
98
+ return descriptor;
99
+ }
100
+ function QueueTask(_target, _key, descriptor) {
101
+ const originalMethod = descriptor.value;
102
+ descriptor.value = function value(...args) {
103
+ queueMicrotask(() => {
104
+ originalMethod.call(this, ...args);
105
+ });
106
+ };
107
+ }
108
+ function Throttle(delay = 300) {
109
+ let lastCall = 0;
110
+ return function(_target, _propertyKey, descriptor) {
111
+ const originalMethod = descriptor.value;
112
+ descriptor.value = function(...args) {
113
+ const now = Date.now();
114
+ if (now - lastCall >= delay) {
115
+ lastCall = now;
116
+ originalMethod.apply(this, args);
117
+ }
118
+ };
119
+ return descriptor;
120
+ };
121
+ }
122
+ export {
123
+ CacheUntilResolved,
124
+ Debounce,
125
+ ImmutableArgs,
126
+ Memoize,
127
+ MemoizeAsync,
128
+ QueueTask,
129
+ Throttle
130
+ };
@@ -0,0 +1,28 @@
1
+ import { Mixins, Singleton } from "./classDecorators";
2
+ import {
3
+ CacheUntilResolved,
4
+ Debounce,
5
+ ImmutableArgs,
6
+ Memoize,
7
+ MemoizeAsync,
8
+ QueueTask,
9
+ Throttle
10
+ } from "./functionDecorators";
11
+ const decorators = {
12
+ class: {
13
+ Mixins,
14
+ Singleton
15
+ },
16
+ function: {
17
+ CacheUntilResolved,
18
+ Debounce,
19
+ ImmutableArgs,
20
+ Memoize,
21
+ MemoizeAsync,
22
+ QueueTask,
23
+ Throttle
24
+ }
25
+ };
26
+ export {
27
+ decorators
28
+ };
@@ -16,6 +16,7 @@ export { useStateSelector, useStateSelectorShallow, } from './utils/custom-hooks
16
16
  export type { UseStateSelectorOptions } from './utils/custom-hooks/use-state-selector.js';
17
17
  export { errorMiddleware } from './data/errorMiddleware.js';
18
18
  export { startSideEffect, createSideEffect, removeSideEffect, clearSideEffects, } from './data/listenerMiddleware.js';
19
+ export { decorators } from './utils/decorators';
19
20
  export { getAuthorizationHeader } from './utils/auth/helper.js';
20
21
  export { getRedirectUrl, removeDoubleSlash } from './utils/url.js';
21
22
  export { createAppStore as configureStore } from './data/store.js';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * A decorator to mix multiple classes into a single class.
3
+ * @param constructors - The constructors of the classes to be mixed in.
4
+ * @returns A class decorator that mixes the provided classes into the target class.
5
+ * @example
6
+ * class A {
7
+ * methodA() {
8
+ * console.log('A');
9
+ * }
10
+ * }
11
+ *
12
+ * class B {
13
+ * methodB() {
14
+ * console.log('B');
15
+ * }
16
+ * }
17
+ * @Mixins(A, B)
18
+ * class C {}
19
+ *
20
+ * const instance = new C();
21
+ * instance.methodA(); // Outputs: 'A'
22
+ * instance.methodB(); // Outputs: 'B'
23
+ */
24
+ export declare function Mixins(...constructors: any[]): (derivedCtor: any) => void;
25
+ declare const SINGLETON_KEY: unique symbol;
26
+ /**
27
+ * A decorator to make a class a singleton.
28
+ * @param type - The class to be made a singleton.
29
+ * @returns A proxy that ensures only one instance of the class is created.
30
+ * @example
31
+ * @Singleton
32
+ * class MyClass {
33
+ * constructor() {
34
+ * console.log('Instance created');
35
+ * }
36
+ * }
37
+ *
38
+ * const instance1 = new MyClass(); // Outputs: 'Instance created'
39
+ * const instance2 = new MyClass(); // No output, same instance returned
40
+ *
41
+ * console.log(instance1 === instance2); // Outputs: true
42
+ */
43
+ export declare function Singleton<T extends new (...args: any[]) => any>(type: T): T & {
44
+ [SINGLETON_KEY]?: InstanceType<T>;
45
+ };
46
+ export {};
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Caches the result of a method until the promise is resolved.
3
+ * @param {any} _target - The target object.
4
+ * @param {string} propertyKey - The name of the method.
5
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
6
+ * @returns {PropertyDescriptor} The modified property descriptor.
7
+ * @example
8
+ * class Example {
9
+ * @CacheUntilResolved
10
+ * async fetchData() {
11
+ * // ...fetch data...
12
+ * }
13
+ * }
14
+ */
15
+ export declare function CacheUntilResolved(_target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
16
+ /**
17
+ * Debounces the method call by the specified delay.
18
+ * @param {number} [delay=300] - The delay in milliseconds.
19
+ * @returns {Function} A function that modifies the property descriptor.
20
+ * @example
21
+ * class Example {
22
+ * @Debounce(500)
23
+ * onResize() {
24
+ * // ...handle resize...
25
+ * }
26
+ * }
27
+ */
28
+ export declare function Debounce(delay?: number): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
29
+ /**
30
+ * Makes the arguments of a method immutable.
31
+ * @param {any} _target - The target object.
32
+ * @param {string | symbol} _propertyKey - The name of the method.
33
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
34
+ * @returns {PropertyDescriptor} The modified property descriptor.
35
+ * @example
36
+ * class Example {
37
+ * @ImmutableArgs
38
+ * updateData(data: any) {
39
+ * // ...update data...
40
+ * }
41
+ * }
42
+ */
43
+ export declare function ImmutableArgs(_target: any, _propertyKey: string | symbol, descriptor: PropertyDescriptor): PropertyDescriptor;
44
+ /**
45
+ * Memoizes the result of a method.
46
+ * @param {any} _target - The target object.
47
+ * @param {string} _key - The name of the method.
48
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
49
+ * @returns {PropertyDescriptor} The modified property descriptor.
50
+ * @example
51
+ * class Example {
52
+ * @Memoize
53
+ * computeValue(x: number) {
54
+ * return x * 2;
55
+ * }
56
+ * }
57
+ */
58
+ export declare function Memoize(_target: any, _key: string, descriptor: PropertyDescriptor): void;
59
+ /**
60
+ * Memoizes the result of an async method.
61
+ * @param {any} _target - The target object.
62
+ * @param {string} _propertyKey - The name of the method.
63
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
64
+ * @returns {PropertyDescriptor} The modified property descriptor.
65
+ * @example
66
+ * class Example {
67
+ * @MemoizeAsync
68
+ * async fetchData() {
69
+ * // ...fetch data...
70
+ * }
71
+ * }
72
+ */
73
+ export declare function MemoizeAsync(_target: any, _propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
74
+ /**
75
+ * Queues the method call as a microtask.
76
+ * @param {any} _target - The target object.
77
+ * @param {string} _key - The name of the method.
78
+ * @param {PropertyDescriptor} descriptor - The property descriptor.
79
+ * @returns {PropertyDescriptor} The modified property descriptor.
80
+ * @example
81
+ * class Example {
82
+ * @QueueTask
83
+ * processTask() {
84
+ * // ...process task...
85
+ * }
86
+ * }
87
+ */
88
+ export declare function QueueTask(_target: unknown, _key: string, descriptor: PropertyDescriptor): void;
89
+ /**
90
+ * Throttles the method call by the specified delay.
91
+ * @param {number} [delay=300] - The delay in milliseconds.
92
+ * @returns {Function} A function that modifies the property descriptor.
93
+ * @example
94
+ * class Example {
95
+ * @Throttle(500)
96
+ * onScroll() {
97
+ * // ...handle scroll...
98
+ * }
99
+ * }
100
+ */
101
+ export declare function Throttle(delay?: number): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -0,0 +1,18 @@
1
+ import { Mixins, Singleton } from './classDecorators';
2
+ import { CacheUntilResolved, Debounce, ImmutableArgs, Memoize, MemoizeAsync, QueueTask, Throttle } from './functionDecorators';
3
+ declare const decorators: {
4
+ class: {
5
+ Mixins: typeof Mixins;
6
+ Singleton: typeof Singleton;
7
+ };
8
+ function: {
9
+ CacheUntilResolved: typeof CacheUntilResolved;
10
+ Debounce: typeof Debounce;
11
+ ImmutableArgs: typeof ImmutableArgs;
12
+ Memoize: typeof Memoize;
13
+ MemoizeAsync: typeof MemoizeAsync;
14
+ QueueTask: typeof QueueTask;
15
+ Throttle: typeof Throttle;
16
+ };
17
+ };
18
+ export { decorators };