@vve/redux-saga 9.0.0-alpha.2 → 9.0.0-alpha.4

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 (75) hide show
  1. package/es/effects.js +3 -2
  2. package/es/effects.js.map +1 -0
  3. package/es/index.js +11 -10
  4. package/es/index.js.map +1 -0
  5. package/es/internal/buffers.js +21 -45
  6. package/es/internal/buffers.js.map +1 -0
  7. package/es/internal/channel.js +36 -87
  8. package/es/internal/channel.js.map +1 -0
  9. package/es/internal/channels-trans-table.png +0 -0
  10. package/es/internal/convenient-io.js +6 -19
  11. package/es/internal/convenient-io.js.map +1 -0
  12. package/es/internal/io-helpers.js +7 -9
  13. package/es/internal/io-helpers.js.map +1 -0
  14. package/es/internal/io.js +70 -113
  15. package/es/internal/io.js.map +1 -0
  16. package/es/internal/middleware.js +42 -45
  17. package/es/internal/middleware.js.map +1 -0
  18. package/es/internal/proc.js +188 -358
  19. package/es/internal/proc.js.map +1 -0
  20. package/es/internal/runSaga.js +20 -27
  21. package/es/internal/runSaga.js.map +1 -0
  22. package/es/internal/sagaHelpers/fsmIterator.js +13 -22
  23. package/es/internal/sagaHelpers/fsmIterator.js.map +1 -0
  24. package/es/internal/sagaHelpers/index.js +12 -13
  25. package/es/internal/sagaHelpers/index.js.map +1 -0
  26. package/es/internal/sagaHelpers/takeEvery.js +13 -20
  27. package/es/internal/sagaHelpers/takeEvery.js.map +1 -0
  28. package/es/internal/sagaHelpers/takeLatest.js +19 -33
  29. package/es/internal/sagaHelpers/takeLatest.js.map +1 -0
  30. package/es/internal/sagaHelpers/throttle.js +22 -36
  31. package/es/internal/sagaHelpers/throttle.js.map +1 -0
  32. package/es/internal/scheduler.js +7 -11
  33. package/es/internal/scheduler.js.map +1 -0
  34. package/es/internal/utils.js +101 -205
  35. package/es/internal/utils.js.map +1 -0
  36. package/es/utils.js +5 -4
  37. package/es/utils.js.map +1 -0
  38. package/lib/effects.js +138 -30
  39. package/lib/effects.js.map +1 -0
  40. package/lib/index.js +86 -48
  41. package/lib/index.js.map +1 -0
  42. package/lib/internal/buffers.js +24 -48
  43. package/lib/internal/buffers.js.map +1 -0
  44. package/lib/internal/channel.js +43 -100
  45. package/lib/internal/channel.js.map +1 -0
  46. package/lib/internal/channels-trans-table.png +0 -0
  47. package/lib/internal/convenient-io.js +10 -23
  48. package/lib/internal/convenient-io.js.map +1 -0
  49. package/lib/internal/io-helpers.js +10 -15
  50. package/lib/internal/io-helpers.js.map +1 -0
  51. package/lib/internal/io.js +89 -149
  52. package/lib/internal/io.js.map +1 -0
  53. package/lib/internal/middleware.js +46 -51
  54. package/lib/internal/middleware.js.map +1 -0
  55. package/lib/internal/proc.js +194 -372
  56. package/lib/internal/proc.js.map +1 -0
  57. package/lib/internal/runSaga.js +25 -35
  58. package/lib/internal/runSaga.js.map +1 -0
  59. package/lib/internal/sagaHelpers/fsmIterator.js +19 -29
  60. package/lib/internal/sagaHelpers/fsmIterator.js.map +1 -0
  61. package/lib/internal/sagaHelpers/index.js +37 -27
  62. package/lib/internal/sagaHelpers/index.js.map +1 -0
  63. package/lib/internal/sagaHelpers/takeEvery.js +19 -31
  64. package/lib/internal/sagaHelpers/takeEvery.js.map +1 -0
  65. package/lib/internal/sagaHelpers/takeLatest.js +25 -44
  66. package/lib/internal/sagaHelpers/takeLatest.js.map +1 -0
  67. package/lib/internal/sagaHelpers/throttle.js +28 -49
  68. package/lib/internal/sagaHelpers/throttle.js.map +1 -0
  69. package/lib/internal/scheduler.js +11 -15
  70. package/lib/internal/scheduler.js.map +1 -0
  71. package/lib/internal/utils.js +119 -247
  72. package/lib/internal/utils.js.map +1 -0
  73. package/lib/utils.js +69 -22
  74. package/lib/utils.js.map +1 -0
  75. package/package.json +5 -4
@@ -1,72 +1,51 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
4
- exports["default"] = throttle;
5
-
6
- var _fsmIterator = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./fsmIterator"));
7
-
8
- var _io = /*#__PURE__*/require("../io");
9
-
10
- var _channel = /*#__PURE__*/require("../channel");
11
-
12
- var _buffers = /*#__PURE__*/require("../buffers");
13
-
14
- var _utils = /*#__PURE__*/require("../utils");
15
-
16
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = throttle;
8
+ var _fsmIterator = _interopRequireWildcard(require("./fsmIterator"));
9
+ var _io = require("../io");
10
+ var _channel = require("../channel");
11
+ var _buffers = require("../buffers");
12
+ var _utils = require("../utils");
20
13
  function throttle(delayLength, pattern, worker) {
21
14
  for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
22
15
  args[_key - 3] = arguments[_key];
23
16
  }
24
-
25
17
  var action, channel;
26
18
  var yActionChannel = {
27
19
  done: false,
28
20
  value: (0, _io.actionChannel)(pattern, _buffers.buffers.sliding(1))
29
21
  };
30
-
31
- var yTake = function yTake() {
32
- return {
33
- done: false,
34
- value: (0, _io.take)(channel)
35
- };
36
- };
37
-
38
- var yFork = function yFork(ac) {
39
- return {
40
- done: false,
41
- value: _io.fork.apply(void 0, [worker].concat(args, [ac]))
42
- };
43
- };
44
-
22
+ var yTake = () => ({
23
+ done: false,
24
+ value: (0, _io.take)(channel)
25
+ });
26
+ var yFork = ac => ({
27
+ done: false,
28
+ value: (0, _io.fork)(worker, ...args, ac)
29
+ });
45
30
  var yDelay = {
46
31
  done: false,
47
32
  value: (0, _io.call)(_utils.delay, delayLength)
48
33
  };
49
-
50
- var setAction = function setAction(ac) {
51
- return action = ac;
52
- };
53
-
54
- var setChannel = function setChannel(ch) {
55
- return channel = ch;
56
- };
57
-
58
- return (0, _fsmIterator["default"])({
59
- q1: function q1() {
34
+ var setAction = ac => action = ac;
35
+ var setChannel = ch => channel = ch;
36
+ return (0, _fsmIterator.default)({
37
+ q1() {
60
38
  return ['q2', yActionChannel, setChannel];
61
39
  },
62
- q2: function q2() {
40
+ q2() {
63
41
  return ['q3', yTake(), setAction];
64
42
  },
65
- q3: function q3() {
43
+ q3() {
66
44
  return action === _channel.END ? [_fsmIterator.qEnd] : ['q4', yFork(action)];
67
45
  },
68
- q4: function q4() {
46
+ q4() {
69
47
  return ['q2', yDelay];
70
48
  }
71
- }, 'q1', "throttle(" + (0, _fsmIterator.safeName)(pattern) + ", " + worker.name + ")");
72
- }
49
+ }, 'q1', `throttle(${(0, _fsmIterator.safeName)(pattern)}, ${worker.name})`);
50
+ }
51
+ //# sourceMappingURL=throttle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throttle.js","names":["_fsmIterator","_interopRequireWildcard","require","_io","_channel","_buffers","_utils","throttle","delayLength","pattern","worker","_len","arguments","length","args","Array","_key","action","channel","yActionChannel","done","value","actionChannel","buffers","sliding","yTake","take","yFork","ac","fork","yDelay","call","delay","setAction","setChannel","ch","fsmIterator","q1","q2","q3","END","qEnd","q4","safeName","name"],"sources":["../../../throttle.js"],"sourcesContent":["import fsmIterator, { qEnd, safeName } from './fsmIterator'\nimport { take, fork, actionChannel, call } from '../io'\nimport { END } from '../channel'\nimport { buffers } from '../buffers'\nimport { delay } from '../utils'\n\nexport default function throttle(delayLength, pattern, worker, ...args) {\n let action, channel\n\n const yActionChannel = { done: false, value: actionChannel(pattern, buffers.sliding(1)) }\n const yTake = () => ({ done: false, value: take(channel) })\n const yFork = ac => ({ done: false, value: fork(worker, ...args, ac) })\n const yDelay = { done: false, value: call(delay, delayLength) }\n\n const setAction = ac => (action = ac)\n const setChannel = ch => (channel = ch)\n\n return fsmIterator(\n {\n q1() {\n return ['q2', yActionChannel, setChannel]\n },\n q2() {\n return ['q3', yTake(), setAction]\n },\n q3() {\n return action === END ? [qEnd] : ['q4', yFork(action)]\n },\n q4() {\n return ['q2', yDelay]\n },\n },\n 'q1',\n `throttle(${safeName(pattern)}, ${worker.name})`,\n )\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEe,SAASK,QAAQA,CAACC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAW;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,OAAAA,IAAA,WAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,QAAAJ,SAAA,CAAAI,IAAA;EAAA;EACpE,IAAIC,MAAM,EAAEC,OAAO;EAEnB,IAAMC,cAAc,GAAG;IAAEC,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE,IAAAC,iBAAa,EAACb,OAAO,EAAEc,gBAAO,CAACC,OAAO,CAAC,CAAC,CAAC;EAAE,CAAC;EACzF,IAAMC,KAAK,GAAGA,CAAA,MAAO;IAAEL,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE,IAAAK,QAAI,EAACR,OAAO;EAAE,CAAC,CAAC;EAC3D,IAAMS,KAAK,GAAGC,EAAE,KAAK;IAAER,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE,IAAAQ,QAAI,EAACnB,MAAM,EAAE,GAAGI,IAAI,EAAEc,EAAE;EAAE,CAAC,CAAC;EACvE,IAAME,MAAM,GAAG;IAAEV,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE,IAAAU,QAAI,EAACC,YAAK,EAAExB,WAAW;EAAE,CAAC;EAE/D,IAAMyB,SAAS,GAAGL,EAAE,IAAKX,MAAM,GAAGW,EAAG;EACrC,IAAMM,UAAU,GAAGC,EAAE,IAAKjB,OAAO,GAAGiB,EAAG;EAEvC,OAAO,IAAAC,oBAAW,EAChB;IACEC,EAAEA,CAAA,EAAG;MACH,OAAO,CAAC,IAAI,EAAElB,cAAc,EAAEe,UAAU,CAAC;IAC3C,CAAC;IACDI,EAAEA,CAAA,EAAG;MACH,OAAO,CAAC,IAAI,EAAEb,KAAK,EAAE,EAAEQ,SAAS,CAAC;IACnC,CAAC;IACDM,EAAEA,CAAA,EAAG;MACH,OAAOtB,MAAM,KAAKuB,YAAG,GAAG,CAACC,iBAAI,CAAC,GAAG,CAAC,IAAI,EAAEd,KAAK,CAACV,MAAM,CAAC,CAAC;IACxD,CAAC;IACDyB,EAAEA,CAAA,EAAG;MACH,OAAO,CAAC,IAAI,EAAEZ,MAAM,CAAC;IACvB;EACF,CAAC,EACD,IAAI,EACH,YAAW,IAAAa,qBAAQ,EAAClC,OAAO,CAAE,KAAIC,MAAM,CAACkC,IAAK,GAAE,CACjD;AACH"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
4
6
  exports.asap = asap;
5
- exports.suspend = suspend;
6
7
  exports.flush = flush;
8
+ exports.suspend = suspend;
7
9
  var queue = [];
8
10
  /**
9
11
  Variable to hold a counting semaphore
@@ -12,14 +14,13 @@ var queue = [];
12
14
  - Decrementing releases a lock. Zero locks puts the scheduler in a `released` state. This
13
15
  triggers flushing the queued tasks.
14
16
  **/
15
-
16
17
  var semaphore = 0;
18
+
17
19
  /**
18
20
  Executes a task 'atomically'. Tasks scheduled during this execution will be queued
19
21
  and flushed after this task has finished (assuming the scheduler endup in a released
20
22
  state).
21
23
  **/
22
-
23
24
  function exec(task) {
24
25
  try {
25
26
  suspend();
@@ -28,46 +29,41 @@ function exec(task) {
28
29
  release();
29
30
  }
30
31
  }
32
+
31
33
  /**
32
34
  Executes or queues a task depending on the state of the scheduler (`suspended` or `released`)
33
35
  **/
34
-
35
-
36
36
  function asap(task) {
37
37
  queue.push(task);
38
-
39
38
  if (!semaphore) {
40
39
  suspend();
41
40
  flush();
42
41
  }
43
42
  }
43
+
44
44
  /**
45
45
  Puts the scheduler in a `suspended` state. Scheduled tasks will be queued until the
46
46
  scheduler is released.
47
47
  **/
48
-
49
-
50
48
  function suspend() {
51
49
  semaphore++;
52
50
  }
51
+
53
52
  /**
54
53
  Puts the scheduler in a `released` state.
55
54
  **/
56
-
57
-
58
55
  function release() {
59
56
  semaphore--;
60
57
  }
58
+
61
59
  /**
62
60
  Releases the current lock. Executes all queued tasks if the scheduler is in the released state.
63
61
  **/
64
-
65
-
66
62
  function flush() {
67
63
  release();
68
64
  var task;
69
-
70
65
  while (!semaphore && (task = queue.shift()) !== undefined) {
71
66
  exec(task);
72
67
  }
73
- }
68
+ }
69
+ //# sourceMappingURL=scheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.js","names":["queue","semaphore","exec","task","suspend","release","asap","push","flush","shift","undefined"],"sources":["../../scheduler.js"],"sourcesContent":["const queue = []\n/**\n Variable to hold a counting semaphore\n - Incrementing adds a lock and puts the scheduler in a `suspended` state (if it's not\n already suspended)\n - Decrementing releases a lock. Zero locks puts the scheduler in a `released` state. This\n triggers flushing the queued tasks.\n**/\nlet semaphore = 0\n\n/**\n Executes a task 'atomically'. Tasks scheduled during this execution will be queued\n and flushed after this task has finished (assuming the scheduler endup in a released\n state).\n**/\nfunction exec(task) {\n try {\n suspend()\n task()\n } finally {\n release()\n }\n}\n\n/**\n Executes or queues a task depending on the state of the scheduler (`suspended` or `released`)\n**/\nexport function asap(task) {\n queue.push(task)\n\n if (!semaphore) {\n suspend()\n flush()\n }\n}\n\n/**\n Puts the scheduler in a `suspended` state. Scheduled tasks will be queued until the\n scheduler is released.\n**/\nexport function suspend() {\n semaphore++\n}\n\n/**\n Puts the scheduler in a `released` state.\n**/\nfunction release() {\n semaphore--\n}\n\n/**\n Releases the current lock. Executes all queued tasks if the scheduler is in the released state.\n**/\nexport function flush() {\n release()\n\n let task\n while (!semaphore && (task = queue.shift()) !== undefined) {\n exec(task)\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAMA,KAAK,GAAG,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,SAAS,GAAG,CAAC;;AAEjB;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAACC,IAAI,EAAE;EAClB,IAAI;IACFC,OAAO,EAAE;IACTD,IAAI,EAAE;EACR,CAAC,SAAS;IACRE,OAAO,EAAE;EACX;AACF;;AAEA;AACA;AACA;AACO,SAASC,IAAIA,CAACH,IAAI,EAAE;EACzBH,KAAK,CAACO,IAAI,CAACJ,IAAI,CAAC;EAEhB,IAAI,CAACF,SAAS,EAAE;IACdG,OAAO,EAAE;IACTI,KAAK,EAAE;EACT;AACF;;AAEA;AACA;AACA;AACA;AACO,SAASJ,OAAOA,CAAA,EAAG;EACxBH,SAAS,EAAE;AACb;;AAEA;AACA;AACA;AACA,SAASI,OAAOA,CAAA,EAAG;EACjBJ,SAAS,EAAE;AACb;;AAEA;AACA;AACA;AACO,SAASO,KAAKA,CAAA,EAAG;EACtBH,OAAO,EAAE;EAET,IAAIF,IAAI;EACR,OAAO,CAACF,SAAS,IAAI,CAACE,IAAI,GAAGH,KAAK,CAACS,KAAK,EAAE,MAAMC,SAAS,EAAE;IACzDR,IAAI,CAACC,IAAI,CAAC;EACZ;AACF"}