patron-oop 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 (37) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/patron.d.ts +61 -80
  3. package/dist/patron.js +75 -110
  4. package/dist/patron.js.map +1 -1
  5. package/dist/patron.min.js +1 -1
  6. package/dist/patron.mjs +70 -109
  7. package/dist/patron.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/src/Guest/Guest.test.ts +10 -0
  10. package/src/Guest/Guest.ts +28 -35
  11. package/src/Guest/GuestAware.test.ts +6 -8
  12. package/src/Guest/GuestAware.ts +1 -1
  13. package/src/Guest/GuestCast.test.ts +6 -6
  14. package/src/Guest/GuestCast.ts +7 -3
  15. package/src/Guest/GuestChain.test.ts +12 -12
  16. package/src/Guest/GuestChain.ts +11 -11
  17. package/src/Guest/GuestInTheMiddle.test.ts +9 -9
  18. package/src/Guest/GuestInTheMiddle.ts +3 -3
  19. package/src/Guest/GuestPool.test.ts +10 -17
  20. package/src/Guest/GuestPool.ts +10 -6
  21. package/src/Guest/GuestSync.test.ts +2 -2
  22. package/src/Guest/GuestSync.ts +2 -2
  23. package/src/Patron/{PatronOfGuest.test.ts → Patron.test.ts} +4 -7
  24. package/src/Patron/Patron.ts +16 -12
  25. package/src/Patron/PatronOnce.test.ts +3 -6
  26. package/src/Patron/PatronOnce.ts +8 -3
  27. package/src/Patron/PatronPool.test.ts +9 -14
  28. package/src/Patron/PatronPool.ts +16 -10
  29. package/src/Source/SourceOfValue.test.ts +3 -6
  30. package/src/Source/SourceOfValue.ts +7 -3
  31. package/src/index.ts +35 -13
  32. package/src/Guest/GuestCallback.test.ts +0 -13
  33. package/src/Guest/GuestCallback.ts +0 -21
  34. package/src/Patron/PatronOfGuest.ts +0 -17
  35. package/src/Source/Source.ts +0 -12
  36. package/src/Source/SourcesApplied.test.ts +0 -26
  37. package/src/Source/SourcesApplied.ts +0 -39
@@ -1,39 +0,0 @@
1
- type TupleSplit<
2
- T,
3
- N extends number,
4
- O extends readonly any[] = readonly [],
5
- > = O["length"] extends N
6
- ? [O, T]
7
- : T extends readonly [infer F, ...infer R]
8
- ? TupleSplit<readonly [...R], N, readonly [...O, F]>
9
- : [O, T];
10
-
11
- type SkipFirst<T extends readonly any[], N extends number> = TupleSplit<
12
- T,
13
- N
14
- >[1];
15
-
16
- export const sourcesApplied = <T>(
17
- target: T,
18
- methodsSources: Record<string, unknown[]>,
19
- ) => {
20
- return new Proxy(target as object, {
21
- get: function (target: any, property) {
22
- const maybeMethod = target[property];
23
-
24
- if (typeof maybeMethod !== "function") {
25
- return maybeMethod;
26
- }
27
-
28
- return (...args: any[]) => {
29
- const appliedArgs = (methodsSources as any)[property];
30
-
31
- if (appliedArgs) {
32
- return maybeMethod(...appliedArgs, ...args);
33
- }
34
-
35
- return maybeMethod(...args);
36
- };
37
- },
38
- });
39
- };