xstate 6.0.0-alpha.59 → 6.0.0-alpha.60

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 (101) hide show
  1. package/dist/{createActor-224ece29.development.esm.js → createActor-0b85627f.development.esm.js} +72 -3
  2. package/dist/{createActor-72b67075.development.cjs.js → createActor-6f75c8e1.development.cjs.js} +72 -3
  3. package/dist/{createActor-5236aa33.esm.js → createActor-7e02bc1f.esm.js} +72 -3
  4. package/dist/{createActor-7d8aebcc.cjs.js → createActor-83937890.cjs.js} +72 -3
  5. package/dist/declarations/src/SimulatedClock.d.ts +1 -0
  6. package/dist/declarations/src/State.d.ts +2 -0
  7. package/dist/declarations/src/StateMachine.d.ts +1 -0
  8. package/dist/declarations/src/StateNode.d.ts +1 -0
  9. package/dist/declarations/src/actors/callback.d.ts +6 -0
  10. package/dist/declarations/src/actors/index.d.ts +1 -0
  11. package/dist/declarations/src/actors/listener.d.ts +7 -0
  12. package/dist/declarations/src/actors/logic.d.ts +11 -0
  13. package/dist/declarations/src/actors/observable.d.ts +9 -0
  14. package/dist/declarations/src/actors/promise.d.ts +9 -0
  15. package/dist/declarations/src/actors/subscription.d.ts +8 -0
  16. package/dist/declarations/src/assert.d.ts +1 -0
  17. package/dist/declarations/src/base.types.d.ts +17 -2
  18. package/dist/declarations/src/createActor.d.ts +4 -0
  19. package/dist/declarations/src/createMachine.d.ts +2 -0
  20. package/dist/declarations/src/createMachineFromConfig.d.ts +7 -0
  21. package/dist/declarations/src/durable/index.d.ts +13 -0
  22. package/dist/declarations/src/fsm.d.ts +13 -0
  23. package/dist/declarations/src/getNextSnapshot.d.ts +5 -1
  24. package/dist/declarations/src/graph/TestModel.d.ts +3 -0
  25. package/dist/declarations/src/graph/adjacency.d.ts +2 -0
  26. package/dist/declarations/src/graph/graph.d.ts +4 -0
  27. package/dist/declarations/src/graph/pathFromEvents.d.ts +1 -0
  28. package/dist/declarations/src/graph/pathGenerators.d.ts +2 -0
  29. package/dist/declarations/src/graph/shortestPaths.d.ts +1 -0
  30. package/dist/declarations/src/graph/simplePaths.d.ts +1 -0
  31. package/dist/declarations/src/graph/types.d.ts +24 -0
  32. package/dist/declarations/src/inspection.d.ts +12 -0
  33. package/dist/declarations/src/machineVersion.types.d.ts +20 -4
  34. package/dist/declarations/src/machineVersions.d.ts +14 -1
  35. package/dist/declarations/src/mapState.d.ts +2 -0
  36. package/dist/declarations/src/schema.types.d.ts +21 -4
  37. package/dist/declarations/src/scxml/scxml.d.ts +3 -0
  38. package/dist/declarations/src/serialize.d.ts +5 -0
  39. package/dist/declarations/src/setup.d.ts +41 -6
  40. package/dist/declarations/src/spawn.d.ts +1 -0
  41. package/dist/declarations/src/stateUtils.d.ts +1 -0
  42. package/dist/declarations/src/system.d.ts +12 -1
  43. package/dist/declarations/src/toPromise.d.ts +1 -0
  44. package/dist/declarations/src/transition.d.ts +9 -0
  45. package/dist/declarations/src/transitionActions.d.ts +6 -1
  46. package/dist/declarations/src/types.d.ts +242 -44
  47. package/dist/declarations/src/types.v6.d.ts +8 -0
  48. package/dist/declarations/src/utils.d.ts +5 -0
  49. package/dist/declarations/src/validation/index.d.ts +14 -2
  50. package/dist/declarations/src/validation.types.d.ts +8 -1
  51. package/dist/declarations/src/waitFor.d.ts +1 -0
  52. package/dist/{effectDescriptor-7740e170.development.esm.js → effectDescriptor-24a16198.esm.js} +10 -1
  53. package/dist/{effectDescriptor-48919b13.development.cjs.js → effectDescriptor-2983ce40.development.cjs.js} +10 -1
  54. package/dist/{effectDescriptor-3f1dfc32.cjs.js → effectDescriptor-98998bb8.cjs.js} +10 -1
  55. package/dist/{effectDescriptor-e04e6848.esm.js → effectDescriptor-b4adbab8.development.esm.js} +10 -1
  56. package/dist/{schema.types-20693e6b.cjs.js → schema.types-27f7c17d.development.cjs.js} +46 -4
  57. package/dist/{schema.types-a2b10853.development.cjs.js → schema.types-6c3e0a7f.cjs.js} +46 -4
  58. package/dist/{schema.types-1b4319f7.development.esm.js → schema.types-b62f66e9.esm.js} +46 -4
  59. package/dist/{schema.types-7439a117.esm.js → schema.types-e746132a.development.esm.js} +46 -4
  60. package/dist/{types-34ac08ad.cjs.js → types-221e8135.cjs.js} +431 -16
  61. package/dist/{types-b0313706.esm.js → types-985a56c7.esm.js} +431 -16
  62. package/dist/{types-7df72520.development.esm.js → types-b75d5028.development.esm.js} +431 -16
  63. package/dist/{types-80c6a857.development.cjs.js → types-e2c94a91.development.cjs.js} +431 -16
  64. package/dist/xstate-actors.cjs.js +68 -1
  65. package/dist/xstate-actors.development.cjs.js +68 -1
  66. package/dist/xstate-actors.development.esm.js +69 -2
  67. package/dist/xstate-actors.esm.js +69 -2
  68. package/dist/xstate-actors.umd.min.js.map +1 -1
  69. package/dist/xstate-durable.cjs.js +20 -2
  70. package/dist/xstate-durable.development.cjs.js +20 -2
  71. package/dist/xstate-durable.development.esm.js +20 -2
  72. package/dist/xstate-durable.esm.js +20 -2
  73. package/dist/xstate-durable.umd.min.js.map +1 -1
  74. package/dist/xstate-fsm.cjs.js +1 -1
  75. package/dist/xstate-fsm.development.cjs.js +1 -1
  76. package/dist/xstate-fsm.development.esm.js +1 -1
  77. package/dist/xstate-fsm.esm.js +1 -1
  78. package/dist/xstate-fsm.umd.min.js.map +1 -1
  79. package/dist/xstate-graph.cjs.js +21 -1
  80. package/dist/xstate-graph.development.cjs.js +21 -1
  81. package/dist/xstate-graph.development.esm.js +21 -1
  82. package/dist/xstate-graph.esm.js +21 -1
  83. package/dist/xstate-graph.umd.min.js.map +1 -1
  84. package/dist/xstate-scxml.cjs.js +7 -2
  85. package/dist/xstate-scxml.development.cjs.js +7 -2
  86. package/dist/xstate-scxml.development.esm.js +7 -2
  87. package/dist/xstate-scxml.esm.js +7 -2
  88. package/dist/xstate-scxml.umd.min.js +1 -1
  89. package/dist/xstate-scxml.umd.min.js.map +1 -1
  90. package/dist/xstate-validation.cjs.js +21 -3
  91. package/dist/xstate-validation.development.cjs.js +21 -3
  92. package/dist/xstate-validation.development.esm.js +21 -3
  93. package/dist/xstate-validation.esm.js +21 -3
  94. package/dist/xstate-validation.umd.min.js.map +1 -1
  95. package/dist/xstate.cjs.js +78 -6
  96. package/dist/xstate.development.cjs.js +78 -6
  97. package/dist/xstate.development.esm.js +80 -8
  98. package/dist/xstate.esm.js +80 -8
  99. package/dist/xstate.umd.min.js +1 -1
  100. package/dist/xstate.umd.min.js.map +1 -1
  101. package/package.json +1 -1
@@ -334,9 +334,19 @@ function relayMappedToParent(self, system, getEvent) {
334
334
  system._relay(self, self._parent, getEvent());
335
335
  }
336
336
 
337
+ /** @public */
338
+
339
+ /** @public */
340
+
341
+ /** @public */
342
+
343
+ /** @public */
344
+
337
345
  /**
338
346
  * Creates actor logic for listening to emitted events from another actor. Used
339
347
  * internally by `enq.listen()`.
348
+ *
349
+ * @public
340
350
  */
341
351
  function createListenerLogic() {
342
352
  return createAttachedLogic(({
@@ -361,11 +371,24 @@ function createListenerLogic() {
361
371
  }
362
372
 
363
373
  // Singleton logic instance
374
+ /** @public */
364
375
  const listenerLogic = /* #__PURE__ */createListenerLogic();
365
376
 
377
+ /** @public */
378
+
379
+ /** @public */
380
+
381
+ /** @public */
382
+
383
+ /** @public */
384
+
385
+ /** @public */
386
+
366
387
  /**
367
388
  * Creates actor logic for subscribing to lifecycle events (done/error/snapshot)
368
389
  * from another actor. Used internally by `enq.subscribeTo()`.
390
+ *
391
+ * @public
369
392
  */
370
393
  function createSubscriptionLogic() {
371
394
  return createAttachedLogic(({
@@ -403,6 +426,7 @@ function createSubscriptionLogic() {
403
426
  }
404
427
 
405
428
  // Singleton logic instance
429
+ /** @public */
406
430
  const subscriptionLogic = /* #__PURE__ */createSubscriptionLogic();
407
431
 
408
432
  /** Marks the internal lazy scope without imposing structure on custom runtimes. @internal */
@@ -1167,11 +1191,17 @@ function deriveDeferredStarts(effects) {
1167
1191
  }
1168
1192
  return [...attachedStarts, ...childStarts];
1169
1193
  }
1194
+
1195
+ /** @public */
1170
1196
  function isBuiltInExecutableAction(action) {
1171
1197
  return action.kind === 'builtin';
1172
1198
  }
1173
1199
 
1174
- /** Executes transition effects sequentially, awaiting each runtime operation. */
1200
+ /**
1201
+ * Executes transition effects sequentially, awaiting each runtime operation.
1202
+ *
1203
+ * @public
1204
+ */
1175
1205
  async function executeEffects(effects, runtime) {
1176
1206
  for (const effect of effects) {
1177
1207
  await effect.exec(runtime);
@@ -1797,7 +1827,10 @@ function createInertActorScope(actorLogic, snapshot, sourceSelf, sourceActorScop
1797
1827
  return actorScope;
1798
1828
  }
1799
1829
 
1800
- /** @deprecated Use `initialTransition(…)` instead. */
1830
+ /**
1831
+ * @deprecated Use `initialTransition(…)` instead.
1832
+ * @public
1833
+ */
1801
1834
  function getInitialSnapshot(actorLogic, ...[input]) {
1802
1835
  const actorScope = createInertActorScope(actorLogic);
1803
1836
  return actorLogic.initialTransition(input, actorScope)[0];
@@ -1835,6 +1868,7 @@ function getInitialSnapshot(actorLogic, ...[input]) {
1835
1868
  * console.log(nextSnapshot2.value);
1836
1869
  * // =>'red'
1837
1870
  * ```
1871
+ * @public
1838
1872
  */
1839
1873
  function getNextSnapshot(actorLogic, snapshot, event) {
1840
1874
  const actorScope = createInertActorScope(actorLogic, snapshot);
@@ -2410,6 +2444,7 @@ function getStateNodeByPath(stateNode, statePath) {
2410
2444
  * Returns the state nodes represented by the current state value.
2411
2445
  *
2412
2446
  * @param stateValue The state value or State instance
2447
+ * @public
2413
2448
  */
2414
2449
  function getStateNodes(stateNode, stateValue) {
2415
2450
  if (typeof stateValue === 'string') {
@@ -3703,9 +3738,14 @@ function compactSnapshotRecord(value) {
3703
3738
  }
3704
3739
  return value && Object.keys(value).length ? value : emptySnapshotRecord;
3705
3740
  }
3741
+
3742
+ /** @public */
3706
3743
  function isMachineSnapshot(value) {
3707
3744
  return !!value && typeof value === 'object' && 'machine' in value && 'value' in value;
3708
3745
  }
3746
+
3747
+ /** @public */
3748
+
3709
3749
  const machineSnapshotMatches = function matches(testValue) {
3710
3750
  return matchesState(testValue, this.value);
3711
3751
  };
@@ -3990,6 +4030,7 @@ function persistContext(contextPart) {
3990
4030
  return copy ?? contextPart;
3991
4031
  }
3992
4032
 
4033
+ /** @public */
3993
4034
  function matchesState(parentStateId, childStateId) {
3994
4035
  const parentStateValue = toStateValue(parentStateId);
3995
4036
  const childStateValue = toStateValue(childStateId);
@@ -4011,6 +4052,8 @@ function matchesState(parentStateId, childStateId) {
4011
4052
  return matchesState(parentStateValue[key], childStateValue[key]);
4012
4053
  });
4013
4054
  }
4055
+
4056
+ /** @public */
4014
4057
  function checkStateIn(snapshot, stateValue) {
4015
4058
  if (typeof stateValue === 'string' && isStateId(stateValue)) {
4016
4059
  const target = snapshot.machine.getStateNodeById(stateValue);
@@ -4055,6 +4098,8 @@ function toStateValue(stateValue) {
4055
4098
  const statePath = toStatePath(stateValue);
4056
4099
  return pathToStateValue(statePath);
4057
4100
  }
4101
+
4102
+ /** @public */
4058
4103
  function pathToStateValue(statePath) {
4059
4104
  if (statePath.length === 1) {
4060
4105
  return statePath[0];
@@ -4157,6 +4202,8 @@ function normalizeTarget(target) {
4157
4202
  }
4158
4203
  return toArray(target);
4159
4204
  }
4205
+
4206
+ /** @public */
4160
4207
  function toObserver(nextHandler, errorHandler, completionHandler) {
4161
4208
  const isObserver = typeof nextHandler === 'object';
4162
4209
  const self = isObserver ? nextHandler : undefined;
@@ -4184,6 +4231,8 @@ function resolveReferencedActor(machine, src) {
4184
4231
  // A referenced actor may itself be registered by name.
4185
4232
  return typeof configSrc === 'string' ? machine.sources.actors[configSrc] : configSrc;
4186
4233
  }
4234
+
4235
+ /** @experimental */
4187
4236
  function getAllOwnEventDescriptors(snapshot) {
4188
4237
  return [...new Set([...snapshot.nodes.flatMap(sn => sn.ownEvents)])];
4189
4238
  }
@@ -4590,15 +4639,25 @@ function bookSessionId(system) {
4590
4639
  * declared schema), `'internalEvent'` (an internal event type sent from
4591
4640
  * outside its owning actor) or `'stopped'` (the target actor already
4592
4641
  * stopped). Hosts may report additional reasons.
4642
+ *
4643
+ * @public
4593
4644
  */
4594
4645
 
4595
- /** Extra detail attached to a dead letter. */
4646
+ /**
4647
+ * Extra detail attached to a dead letter.
4648
+ *
4649
+ * @public
4650
+ */
4596
4651
 
4597
4652
  /**
4598
4653
  * Describes an event that was rejected at the delivery boundary instead of
4599
4654
  * being delivered to its target actor (a dead letter).
4655
+ *
4656
+ * @public
4600
4657
  */
4601
4658
 
4659
+ /** @experimental */
4660
+
4602
4661
  /** @internal Every operation of `ActorSystemRuntime`, for runtime wrappers. */
4603
4662
  const RUNTIME_OPERATIONS = ['spawnActor', 'startActor', 'stopActor', 'terminateActor', 'emitEvent', 'scheduleTimer', 'cancelTimer', 'cancelAllTimers', 'deadLetter'
4604
4663
  // `runLogic`, `runStep` and `sendEvent` are deliberately absent: durable
@@ -4611,6 +4670,10 @@ function createScheduledTimerId(actor, id) {
4611
4670
  return `${actor.sessionId}.${id}`;
4612
4671
  }
4613
4672
 
4673
+ /** @public */
4674
+
4675
+ /** @public */
4676
+
4614
4677
  // These optional lazy fields intentionally have no emitted initializers.
4615
4678
  // oxlint-disable-next-line typescript/no-unsafe-declaration-merging
4616
4679
 
@@ -5046,6 +5109,8 @@ function createActorRef(logic, options) {
5046
5109
  * system-owned internals. It also satisfies the narrower `ActorRef` contract,
5047
5110
  * so consumer APIs should accept `ActorRef` when they only need to send events
5048
5111
  * or read snapshots.
5112
+ *
5113
+ * @public
5049
5114
  */
5050
5115
  class Actor {
5051
5116
  /**
@@ -5956,6 +6021,9 @@ class Actor {
5956
6021
  return this._snapshot;
5957
6022
  }
5958
6023
  }
6024
+
6025
+ /** @public */
6026
+
5959
6027
  /**
5960
6028
  * Creates a new actor instance for the given actor logic with the provided
5961
6029
  * options, if any.
@@ -5994,6 +6062,7 @@ class Actor {
5994
6062
  * {@link createObservableLogic}, {@link createLogic}, and
5995
6063
  * {@link createAsyncLogic}.
5996
6064
  * @param options - Actor options
6065
+ * @public
5997
6066
  */
5998
6067
  function createActor(logic, options) {
5999
6068
  return new Actor(logic, options);
@@ -336,9 +336,19 @@ function relayMappedToParent(self, system, getEvent) {
336
336
  system._relay(self, self._parent, getEvent());
337
337
  }
338
338
 
339
+ /** @public */
340
+
341
+ /** @public */
342
+
343
+ /** @public */
344
+
345
+ /** @public */
346
+
339
347
  /**
340
348
  * Creates actor logic for listening to emitted events from another actor. Used
341
349
  * internally by `enq.listen()`.
350
+ *
351
+ * @public
342
352
  */
343
353
  function createListenerLogic() {
344
354
  return createAttachedLogic(({
@@ -363,11 +373,24 @@ function createListenerLogic() {
363
373
  }
364
374
 
365
375
  // Singleton logic instance
376
+ /** @public */
366
377
  const listenerLogic = /* #__PURE__ */createListenerLogic();
367
378
 
379
+ /** @public */
380
+
381
+ /** @public */
382
+
383
+ /** @public */
384
+
385
+ /** @public */
386
+
387
+ /** @public */
388
+
368
389
  /**
369
390
  * Creates actor logic for subscribing to lifecycle events (done/error/snapshot)
370
391
  * from another actor. Used internally by `enq.subscribeTo()`.
392
+ *
393
+ * @public
371
394
  */
372
395
  function createSubscriptionLogic() {
373
396
  return createAttachedLogic(({
@@ -405,6 +428,7 @@ function createSubscriptionLogic() {
405
428
  }
406
429
 
407
430
  // Singleton logic instance
431
+ /** @public */
408
432
  const subscriptionLogic = /* #__PURE__ */createSubscriptionLogic();
409
433
 
410
434
  /** Marks the internal lazy scope without imposing structure on custom runtimes. @internal */
@@ -1169,11 +1193,17 @@ function deriveDeferredStarts(effects) {
1169
1193
  }
1170
1194
  return [...attachedStarts, ...childStarts];
1171
1195
  }
1196
+
1197
+ /** @public */
1172
1198
  function isBuiltInExecutableAction(action) {
1173
1199
  return action.kind === 'builtin';
1174
1200
  }
1175
1201
 
1176
- /** Executes transition effects sequentially, awaiting each runtime operation. */
1202
+ /**
1203
+ * Executes transition effects sequentially, awaiting each runtime operation.
1204
+ *
1205
+ * @public
1206
+ */
1177
1207
  async function executeEffects(effects, runtime) {
1178
1208
  for (const effect of effects) {
1179
1209
  await effect.exec(runtime);
@@ -1799,7 +1829,10 @@ function createInertActorScope(actorLogic, snapshot, sourceSelf, sourceActorScop
1799
1829
  return actorScope;
1800
1830
  }
1801
1831
 
1802
- /** @deprecated Use `initialTransition(…)` instead. */
1832
+ /**
1833
+ * @deprecated Use `initialTransition(…)` instead.
1834
+ * @public
1835
+ */
1803
1836
  function getInitialSnapshot(actorLogic, ...[input]) {
1804
1837
  const actorScope = createInertActorScope(actorLogic);
1805
1838
  return actorLogic.initialTransition(input, actorScope)[0];
@@ -1837,6 +1870,7 @@ function getInitialSnapshot(actorLogic, ...[input]) {
1837
1870
  * console.log(nextSnapshot2.value);
1838
1871
  * // =>'red'
1839
1872
  * ```
1873
+ * @public
1840
1874
  */
1841
1875
  function getNextSnapshot(actorLogic, snapshot, event) {
1842
1876
  const actorScope = createInertActorScope(actorLogic, snapshot);
@@ -2412,6 +2446,7 @@ function getStateNodeByPath(stateNode, statePath) {
2412
2446
  * Returns the state nodes represented by the current state value.
2413
2447
  *
2414
2448
  * @param stateValue The state value or State instance
2449
+ * @public
2415
2450
  */
2416
2451
  function getStateNodes(stateNode, stateValue) {
2417
2452
  if (typeof stateValue === 'string') {
@@ -3705,9 +3740,14 @@ function compactSnapshotRecord(value) {
3705
3740
  }
3706
3741
  return value && Object.keys(value).length ? value : emptySnapshotRecord;
3707
3742
  }
3743
+
3744
+ /** @public */
3708
3745
  function isMachineSnapshot(value) {
3709
3746
  return !!value && typeof value === 'object' && 'machine' in value && 'value' in value;
3710
3747
  }
3748
+
3749
+ /** @public */
3750
+
3711
3751
  const machineSnapshotMatches = function matches(testValue) {
3712
3752
  return matchesState(testValue, this.value);
3713
3753
  };
@@ -3992,6 +4032,7 @@ function persistContext(contextPart) {
3992
4032
  return copy ?? contextPart;
3993
4033
  }
3994
4034
 
4035
+ /** @public */
3995
4036
  function matchesState(parentStateId, childStateId) {
3996
4037
  const parentStateValue = toStateValue(parentStateId);
3997
4038
  const childStateValue = toStateValue(childStateId);
@@ -4013,6 +4054,8 @@ function matchesState(parentStateId, childStateId) {
4013
4054
  return matchesState(parentStateValue[key], childStateValue[key]);
4014
4055
  });
4015
4056
  }
4057
+
4058
+ /** @public */
4016
4059
  function checkStateIn(snapshot, stateValue) {
4017
4060
  if (typeof stateValue === 'string' && isStateId(stateValue)) {
4018
4061
  const target = snapshot.machine.getStateNodeById(stateValue);
@@ -4057,6 +4100,8 @@ function toStateValue(stateValue) {
4057
4100
  const statePath = toStatePath(stateValue);
4058
4101
  return pathToStateValue(statePath);
4059
4102
  }
4103
+
4104
+ /** @public */
4060
4105
  function pathToStateValue(statePath) {
4061
4106
  if (statePath.length === 1) {
4062
4107
  return statePath[0];
@@ -4159,6 +4204,8 @@ function normalizeTarget(target) {
4159
4204
  }
4160
4205
  return toArray(target);
4161
4206
  }
4207
+
4208
+ /** @public */
4162
4209
  function toObserver(nextHandler, errorHandler, completionHandler) {
4163
4210
  const isObserver = typeof nextHandler === 'object';
4164
4211
  const self = isObserver ? nextHandler : undefined;
@@ -4186,6 +4233,8 @@ function resolveReferencedActor(machine, src) {
4186
4233
  // A referenced actor may itself be registered by name.
4187
4234
  return typeof configSrc === 'string' ? machine.sources.actors[configSrc] : configSrc;
4188
4235
  }
4236
+
4237
+ /** @experimental */
4189
4238
  function getAllOwnEventDescriptors(snapshot) {
4190
4239
  return [...new Set([...snapshot.nodes.flatMap(sn => sn.ownEvents)])];
4191
4240
  }
@@ -4592,15 +4641,25 @@ function bookSessionId(system) {
4592
4641
  * declared schema), `'internalEvent'` (an internal event type sent from
4593
4642
  * outside its owning actor) or `'stopped'` (the target actor already
4594
4643
  * stopped). Hosts may report additional reasons.
4644
+ *
4645
+ * @public
4595
4646
  */
4596
4647
 
4597
- /** Extra detail attached to a dead letter. */
4648
+ /**
4649
+ * Extra detail attached to a dead letter.
4650
+ *
4651
+ * @public
4652
+ */
4598
4653
 
4599
4654
  /**
4600
4655
  * Describes an event that was rejected at the delivery boundary instead of
4601
4656
  * being delivered to its target actor (a dead letter).
4657
+ *
4658
+ * @public
4602
4659
  */
4603
4660
 
4661
+ /** @experimental */
4662
+
4604
4663
  /** @internal Every operation of `ActorSystemRuntime`, for runtime wrappers. */
4605
4664
  const RUNTIME_OPERATIONS = ['spawnActor', 'startActor', 'stopActor', 'terminateActor', 'emitEvent', 'scheduleTimer', 'cancelTimer', 'cancelAllTimers', 'deadLetter'
4606
4665
  // `runLogic`, `runStep` and `sendEvent` are deliberately absent: durable
@@ -4613,6 +4672,10 @@ function createScheduledTimerId(actor, id) {
4613
4672
  return `${actor.sessionId}.${id}`;
4614
4673
  }
4615
4674
 
4675
+ /** @public */
4676
+
4677
+ /** @public */
4678
+
4616
4679
  // These optional lazy fields intentionally have no emitted initializers.
4617
4680
  // oxlint-disable-next-line typescript/no-unsafe-declaration-merging
4618
4681
 
@@ -5048,6 +5111,8 @@ function createActorRef(logic, options) {
5048
5111
  * system-owned internals. It also satisfies the narrower `ActorRef` contract,
5049
5112
  * so consumer APIs should accept `ActorRef` when they only need to send events
5050
5113
  * or read snapshots.
5114
+ *
5115
+ * @public
5051
5116
  */
5052
5117
  class Actor {
5053
5118
  /**
@@ -5958,6 +6023,9 @@ class Actor {
5958
6023
  return this._snapshot;
5959
6024
  }
5960
6025
  }
6026
+
6027
+ /** @public */
6028
+
5961
6029
  /**
5962
6030
  * Creates a new actor instance for the given actor logic with the provided
5963
6031
  * options, if any.
@@ -5996,6 +6064,7 @@ class Actor {
5996
6064
  * {@link createObservableLogic}, {@link createLogic}, and
5997
6065
  * {@link createAsyncLogic}.
5998
6066
  * @param options - Actor options
6067
+ * @public
5999
6068
  */
6000
6069
  function createActor(logic, options) {
6001
6070
  return new Actor(logic, options);
@@ -333,9 +333,19 @@ function relayMappedToParent(self, system, getEvent) {
333
333
  system._relay(self, self._parent, getEvent());
334
334
  }
335
335
 
336
+ /** @public */
337
+
338
+ /** @public */
339
+
340
+ /** @public */
341
+
342
+ /** @public */
343
+
336
344
  /**
337
345
  * Creates actor logic for listening to emitted events from another actor. Used
338
346
  * internally by `enq.listen()`.
347
+ *
348
+ * @public
339
349
  */
340
350
  function createListenerLogic() {
341
351
  return createAttachedLogic(({
@@ -360,11 +370,24 @@ function createListenerLogic() {
360
370
  }
361
371
 
362
372
  // Singleton logic instance
373
+ /** @public */
363
374
  const listenerLogic = /* #__PURE__ */createListenerLogic();
364
375
 
376
+ /** @public */
377
+
378
+ /** @public */
379
+
380
+ /** @public */
381
+
382
+ /** @public */
383
+
384
+ /** @public */
385
+
365
386
  /**
366
387
  * Creates actor logic for subscribing to lifecycle events (done/error/snapshot)
367
388
  * from another actor. Used internally by `enq.subscribeTo()`.
389
+ *
390
+ * @public
368
391
  */
369
392
  function createSubscriptionLogic() {
370
393
  return createAttachedLogic(({
@@ -402,6 +425,7 @@ function createSubscriptionLogic() {
402
425
  }
403
426
 
404
427
  // Singleton logic instance
428
+ /** @public */
405
429
  const subscriptionLogic = /* #__PURE__ */createSubscriptionLogic();
406
430
 
407
431
  /** Marks the internal lazy scope without imposing structure on custom runtimes. @internal */
@@ -1159,11 +1183,17 @@ function deriveDeferredStarts(effects) {
1159
1183
  }
1160
1184
  return [...attachedStarts, ...childStarts];
1161
1185
  }
1186
+
1187
+ /** @public */
1162
1188
  function isBuiltInExecutableAction(action) {
1163
1189
  return action.kind === 'builtin';
1164
1190
  }
1165
1191
 
1166
- /** Executes transition effects sequentially, awaiting each runtime operation. */
1192
+ /**
1193
+ * Executes transition effects sequentially, awaiting each runtime operation.
1194
+ *
1195
+ * @public
1196
+ */
1167
1197
  async function executeEffects(effects, runtime) {
1168
1198
  for (const effect of effects) {
1169
1199
  await effect.exec(runtime);
@@ -1789,7 +1819,10 @@ function createInertActorScope(actorLogic, snapshot, sourceSelf, sourceActorScop
1789
1819
  return actorScope;
1790
1820
  }
1791
1821
 
1792
- /** @deprecated Use `initialTransition(…)` instead. */
1822
+ /**
1823
+ * @deprecated Use `initialTransition(…)` instead.
1824
+ * @public
1825
+ */
1793
1826
  function getInitialSnapshot(actorLogic, ...[input]) {
1794
1827
  const actorScope = createInertActorScope(actorLogic);
1795
1828
  return actorLogic.initialTransition(input, actorScope)[0];
@@ -1827,6 +1860,7 @@ function getInitialSnapshot(actorLogic, ...[input]) {
1827
1860
  * console.log(nextSnapshot2.value);
1828
1861
  * // =>'red'
1829
1862
  * ```
1863
+ * @public
1830
1864
  */
1831
1865
  function getNextSnapshot(actorLogic, snapshot, event) {
1832
1866
  const actorScope = createInertActorScope(actorLogic, snapshot);
@@ -2392,6 +2426,7 @@ function getStateNodeByPath(stateNode, statePath) {
2392
2426
  * Returns the state nodes represented by the current state value.
2393
2427
  *
2394
2428
  * @param stateValue The state value or State instance
2429
+ * @public
2395
2430
  */
2396
2431
  function getStateNodes(stateNode, stateValue) {
2397
2432
  if (typeof stateValue === 'string') {
@@ -3685,9 +3720,14 @@ function compactSnapshotRecord(value) {
3685
3720
  }
3686
3721
  return value && Object.keys(value).length ? value : emptySnapshotRecord;
3687
3722
  }
3723
+
3724
+ /** @public */
3688
3725
  function isMachineSnapshot(value) {
3689
3726
  return !!value && typeof value === 'object' && 'machine' in value && 'value' in value;
3690
3727
  }
3728
+
3729
+ /** @public */
3730
+
3691
3731
  const machineSnapshotMatches = function matches(testValue) {
3692
3732
  return matchesState(testValue, this.value);
3693
3733
  };
@@ -3969,6 +4009,7 @@ function persistContext(contextPart) {
3969
4009
  return copy ?? contextPart;
3970
4010
  }
3971
4011
 
4012
+ /** @public */
3972
4013
  function matchesState(parentStateId, childStateId) {
3973
4014
  const parentStateValue = toStateValue(parentStateId);
3974
4015
  const childStateValue = toStateValue(childStateId);
@@ -3990,6 +4031,8 @@ function matchesState(parentStateId, childStateId) {
3990
4031
  return matchesState(parentStateValue[key], childStateValue[key]);
3991
4032
  });
3992
4033
  }
4034
+
4035
+ /** @public */
3993
4036
  function checkStateIn(snapshot, stateValue) {
3994
4037
  if (typeof stateValue === 'string' && isStateId(stateValue)) {
3995
4038
  const target = snapshot.machine.getStateNodeById(stateValue);
@@ -4034,6 +4077,8 @@ function toStateValue(stateValue) {
4034
4077
  const statePath = toStatePath(stateValue);
4035
4078
  return pathToStateValue(statePath);
4036
4079
  }
4080
+
4081
+ /** @public */
4037
4082
  function pathToStateValue(statePath) {
4038
4083
  if (statePath.length === 1) {
4039
4084
  return statePath[0];
@@ -4133,6 +4178,8 @@ function normalizeTarget(target) {
4133
4178
  }
4134
4179
  return toArray(target);
4135
4180
  }
4181
+
4182
+ /** @public */
4136
4183
  function toObserver(nextHandler, errorHandler, completionHandler) {
4137
4184
  const isObserver = typeof nextHandler === 'object';
4138
4185
  const self = isObserver ? nextHandler : undefined;
@@ -4160,6 +4207,8 @@ function resolveReferencedActor(machine, src) {
4160
4207
  // A referenced actor may itself be registered by name.
4161
4208
  return typeof configSrc === 'string' ? machine.sources.actors[configSrc] : configSrc;
4162
4209
  }
4210
+
4211
+ /** @experimental */
4163
4212
  function getAllOwnEventDescriptors(snapshot) {
4164
4213
  return [...new Set([...snapshot.nodes.flatMap(sn => sn.ownEvents)])];
4165
4214
  }
@@ -4560,15 +4609,25 @@ function bookSessionId(system) {
4560
4609
  * declared schema), `'internalEvent'` (an internal event type sent from
4561
4610
  * outside its owning actor) or `'stopped'` (the target actor already
4562
4611
  * stopped). Hosts may report additional reasons.
4612
+ *
4613
+ * @public
4563
4614
  */
4564
4615
 
4565
- /** Extra detail attached to a dead letter. */
4616
+ /**
4617
+ * Extra detail attached to a dead letter.
4618
+ *
4619
+ * @public
4620
+ */
4566
4621
 
4567
4622
  /**
4568
4623
  * Describes an event that was rejected at the delivery boundary instead of
4569
4624
  * being delivered to its target actor (a dead letter).
4625
+ *
4626
+ * @public
4570
4627
  */
4571
4628
 
4629
+ /** @experimental */
4630
+
4572
4631
  /** @internal Every operation of `ActorSystemRuntime`, for runtime wrappers. */
4573
4632
  const RUNTIME_OPERATIONS = ['spawnActor', 'startActor', 'stopActor', 'terminateActor', 'emitEvent', 'scheduleTimer', 'cancelTimer', 'cancelAllTimers', 'deadLetter'
4574
4633
  // `runLogic`, `runStep` and `sendEvent` are deliberately absent: durable
@@ -4581,6 +4640,10 @@ function createScheduledTimerId(actor, id) {
4581
4640
  return `${actor.sessionId}.${id}`;
4582
4641
  }
4583
4642
 
4643
+ /** @public */
4644
+
4645
+ /** @public */
4646
+
4584
4647
  // These optional lazy fields intentionally have no emitted initializers.
4585
4648
  // oxlint-disable-next-line typescript/no-unsafe-declaration-merging
4586
4649
 
@@ -5013,6 +5076,8 @@ function createActorRef(logic, options) {
5013
5076
  * system-owned internals. It also satisfies the narrower `ActorRef` contract,
5014
5077
  * so consumer APIs should accept `ActorRef` when they only need to send events
5015
5078
  * or read snapshots.
5079
+ *
5080
+ * @public
5016
5081
  */
5017
5082
  class Actor {
5018
5083
  /**
@@ -5917,6 +5982,9 @@ class Actor {
5917
5982
  return this._snapshot;
5918
5983
  }
5919
5984
  }
5985
+
5986
+ /** @public */
5987
+
5920
5988
  /**
5921
5989
  * Creates a new actor instance for the given actor logic with the provided
5922
5990
  * options, if any.
@@ -5955,6 +6023,7 @@ class Actor {
5955
6023
  * {@link createObservableLogic}, {@link createLogic}, and
5956
6024
  * {@link createAsyncLogic}.
5957
6025
  * @param options - Actor options
6026
+ * @public
5958
6027
  */
5959
6028
  function createActor(logic, options) {
5960
6029
  return new Actor(logic, options);