solid-objects 0.13.0 → 0.13.2

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 (73) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +71 -9
  3. package/dist/actor.d.ts +5 -0
  4. package/dist/actor.d.ts.map +1 -1
  5. package/dist/actor.js +32 -0
  6. package/dist/actor.js.map +1 -1
  7. package/dist/broadcast-worker.d.ts +2 -0
  8. package/dist/broadcast-worker.d.ts.map +1 -1
  9. package/dist/broadcast-worker.js +25 -5
  10. package/dist/broadcast-worker.js.map +1 -1
  11. package/dist/configuration.d.ts +2 -0
  12. package/dist/configuration.d.ts.map +1 -1
  13. package/dist/configuration.js +3 -0
  14. package/dist/configuration.js.map +1 -1
  15. package/dist/doctor.js +2 -2
  16. package/dist/doctor.js.map +1 -1
  17. package/dist/effect-worker.d.ts +2 -0
  18. package/dist/effect-worker.d.ts.map +1 -1
  19. package/dist/effect-worker.js +25 -5
  20. package/dist/effect-worker.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/polling-backoff.d.ts +23 -0
  26. package/dist/polling-backoff.d.ts.map +1 -0
  27. package/dist/polling-backoff.js +33 -0
  28. package/dist/polling-backoff.js.map +1 -0
  29. package/dist/process-administration.d.ts +5 -0
  30. package/dist/process-administration.d.ts.map +1 -1
  31. package/dist/process-administration.js +9 -0
  32. package/dist/process-administration.js.map +1 -1
  33. package/dist/records.d.ts +1 -0
  34. package/dist/records.d.ts.map +1 -1
  35. package/dist/reminder-administration.d.ts +2 -0
  36. package/dist/reminder-administration.d.ts.map +1 -1
  37. package/dist/reminder-administration.js.map +1 -1
  38. package/dist/reminder-scheduler.d.ts +2 -0
  39. package/dist/reminder-scheduler.d.ts.map +1 -1
  40. package/dist/reminder-scheduler.js +26 -6
  41. package/dist/reminder-scheduler.js.map +1 -1
  42. package/dist/repository.d.ts +1 -0
  43. package/dist/repository.d.ts.map +1 -1
  44. package/dist/repository.js +17 -4
  45. package/dist/repository.js.map +1 -1
  46. package/dist/runtime.d.ts +6 -1
  47. package/dist/runtime.d.ts.map +1 -1
  48. package/dist/runtime.js +43 -5
  49. package/dist/runtime.js.map +1 -1
  50. package/dist/schema.d.ts.map +1 -1
  51. package/dist/schema.js +14 -1
  52. package/dist/schema.js.map +1 -1
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/wake-up/postgresql.d.ts.map +1 -1
  56. package/dist/wake-up/postgresql.js +12 -11
  57. package/dist/wake-up/postgresql.js.map +1 -1
  58. package/dist/wake-up.d.ts +1 -1
  59. package/dist/wake-up.d.ts.map +1 -1
  60. package/dist/wake-up.js +11 -10
  61. package/dist/wake-up.js.map +1 -1
  62. package/dist/worker.d.ts +2 -0
  63. package/dist/worker.d.ts.map +1 -1
  64. package/dist/worker.js +25 -5
  65. package/dist/worker.js.map +1 -1
  66. package/docs/api.md +52 -4
  67. package/docs/architecture.md +5 -2
  68. package/docs/benchmarks.md +40 -0
  69. package/docs/configuration.md +11 -2
  70. package/docs/operations.md +39 -10
  71. package/docs/parity.md +2 -2
  72. package/docs/releasing.md +2 -2
  73. package/package.json +2 -1
package/dist/worker.d.ts CHANGED
@@ -6,9 +6,11 @@ export declare class Worker {
6
6
  private registered;
7
7
  private stopping;
8
8
  private readonly activations;
9
+ private readonly pollingBackoff;
9
10
  constructor(runtime: SolidObjectsRuntime, options?: {
10
11
  setupFailure?: "report" | "throw";
11
12
  });
13
+ get currentPollingIntervalMilliseconds(): number;
12
14
  runOnce(options?: {
13
15
  activationRetention?: "retain" | "release";
14
16
  }): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AASvD,qBAAa,MAA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jB,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CACjC,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
package/dist/worker.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { ActorSetupFailed, ApplicationWriteForbidden, LostActivation, StateMigrationError, } from "./errors.js";
3
+ import { PollingBackoff } from "./polling-backoff.js";
3
4
  export class Worker {
4
5
  runtime;
5
6
  options;
@@ -7,9 +8,21 @@ export class Worker {
7
8
  registered = false;
8
9
  stopping = false;
9
10
  activations = new Map();
11
+ pollingBackoff;
10
12
  constructor(runtime, options = {}) {
11
13
  this.runtime = runtime;
12
14
  this.options = options;
15
+ this.pollingBackoff = new PollingBackoff({
16
+ minimumIntervalMilliseconds: Math.min(runtime.settings.pollingIntervalMilliseconds, runtime.settings.leaseRenewalIntervalMilliseconds),
17
+ maximumIntervalMilliseconds: Math.min(runtime.settings.idlePollingIntervalMilliseconds, runtime.settings.leaseRenewalIntervalMilliseconds),
18
+ onChange: (transition) => runtime.emitInstrumentation("polling.interval_changed", {
19
+ role: "actors",
20
+ ...transition,
21
+ }),
22
+ });
23
+ }
24
+ get currentPollingIntervalMilliseconds() {
25
+ return this.pollingBackoff.currentIntervalMilliseconds;
13
26
  }
14
27
  async runOnce(options = {}) {
15
28
  try {
@@ -111,15 +124,22 @@ export class Worker {
111
124
  }
112
125
  async run(signal) {
113
126
  await this.ensureRegistered();
127
+ await this.runtime.warnIfPollingIsOnlyCrossProcessWakeUp();
114
128
  while (!signal.aborted && !this.stopping) {
115
129
  const wakeUp = await this.runtime.settings.wakeUp.watch("actors");
116
130
  const processed = await this.runOnce();
117
- if (processed === 0) {
118
- await wakeUp.wait({
119
- timeoutMilliseconds: Math.min(this.runtime.settings.pollingIntervalMilliseconds, this.runtime.settings.leaseRenewalIntervalMilliseconds),
120
- signal,
121
- });
131
+ if (processed > 0) {
132
+ this.pollingBackoff.reset("work");
133
+ continue;
122
134
  }
135
+ const notified = await wakeUp.wait({
136
+ timeoutMilliseconds: this.pollingBackoff.currentIntervalMilliseconds,
137
+ signal,
138
+ });
139
+ if (notified === false)
140
+ this.pollingBackoff.recordIdle();
141
+ else
142
+ this.pollingBackoff.reset("wake_up");
123
143
  }
124
144
  await this.stop();
125
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAWpB,MAAM,OAAO,MAAM;IAOE;IACA;IAPV,SAAS,GAAG,UAAU,EAAE,CAAA;IACzB,UAAU,GAAG,KAAK,CAAA;IAClB,QAAQ,GAAG,KAAK,CAAA;IACP,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAA;IAElE,YACmB,OAA4B,EAC5B,UAAiD,EAAE;QADnD,YAAO,GAAP,OAAO,CAAqB;QAC5B,YAAO,GAAP,OAAO,CAA4C;IACnE,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,UAA0D,EAAE;QACxE,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO,CAAC,CAAA;YAC3B,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAA;YAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC9D,MAAM,IAAI,CAAC,yBAAyB,EAAE,CAAA;YACtC,IAAI,MAAM,GAAiC,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAC7E,IAAI,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;YAChF,IAAI,CAAC,I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AO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,oCAAoC,EAAE,MAAM,CAAC,CAAA;QAC5E,IAAI,MAAM,CAAC,OAAO;YAAE,OAAM;QAC1B,MAAM,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACtD,CAAC;AACH,CAAC"}
package/docs/api.md CHANGED
@@ -79,6 +79,48 @@ function playerForSession<PlayerType extends { sessionId: string }>(options: {
79
79
  }
80
80
  ```
81
81
 
82
+ ### Reminders
83
+
84
+ A reminder is one alarm per actor and name. Scheduling a name that is already
85
+ armed **moves the existing alarm** rather than adding a second one, which is
86
+ what makes a reminder safe to re-arm from a handler that may run more than once.
87
+
88
+ Without a key that name is the operation, so one actor holds one alarm per
89
+ operation, and arming one per queued item keeps only the last:
90
+
91
+ ```typescript
92
+ // Wrong. Every entry overwrites the previous entry's alarm.
93
+ add({ entry }: { entry: Entry }): void {
94
+ this.entries = [...this.entries, entry]
95
+ this.schedule({ at: new Date(entry.waitUntil) }).deliver!()
96
+ }
97
+ ```
98
+
99
+ Pass `key` when an actor is waiting on several things at once. The key is your
100
+ own identifier for the item and names that item's alarm, so each item gets one:
101
+
102
+ ```typescript
103
+ add({ entry }: { entry: Entry }): void {
104
+ this.entries = [...this.entries, entry]
105
+ this.schedule({ at: new Date(entry.waitUntil), key: entry.id }).deliver!()
106
+ }
107
+ ```
108
+
109
+ Scheduling the same key again moves that item's alarm and leaves the others
110
+ alone. The operation still decides which handler runs; the key only decides
111
+ which alarm is which.
112
+
113
+ A key must be non-empty, and the name it composes must fit the 255 characters
114
+ MySQL holds it in. That is checked on the composed name rather than the key
115
+ alone, so a long operation with a short key is caught too. A key may hold colons
116
+ of its own, because an actor member name cannot.
117
+
118
+ An actor that only needs to know "what is next" can still keep one alarm and
119
+ drain everything due when it fires. That costs one row instead of one per item
120
+ and cannot strand an entry when an occurrence is coalesced, so prefer it for a
121
+ large queue of interchangeable items and prefer `key` when an item needs an
122
+ alarm that can be moved on its own.
123
+
82
124
  ### Runtime managers
83
125
 
84
126
  Every manager below is available as a property on `SolidObjectsRuntime`; the
@@ -89,6 +131,9 @@ class and result types are also exported for integration typing.
89
131
  idempotent paused-alarm `resume()`.
90
132
  - `runtime.processes` / `ProcessManager`: immutable role `all()` and stale-owner
91
133
  `cleanup()`.
134
+ - `runtime.administration` / `AdministrationManager`: an authorized
135
+ `processes()` query for inspecting live and stale process rows through the
136
+ runtime's own database adapter.
92
137
  - `runtime.reconciliation` / `ReconciliationManager`: `active()`,
93
138
  `withoutPendingWork()`, `statesFor()`, and `orphaned()` bounded reads.
94
139
  - `runtime.retention` / `RetentionManager`: `preview()` and authorized `prune()`
@@ -179,14 +224,17 @@ Factories should create fresh mutable state and `stop()` should be idempotent.
179
224
  exported for test runners and hosts that intentionally operate roles outside
180
225
  `runtime.run()`. Runtime factory methods create the same classes. Each provides
181
226
  `runOnce()`, bounded `runUntilIdle()`, `run(signal)`, `requestShutdown()`,
182
- `stopped()`, and `stop()`. Manual roles still register process ownership and
183
- must be stopped. Prefer `runtime.run()` in production and `runtime.testing` in
184
- tests.
227
+ `stopped()`, `stop()`, and the inspectable
228
+ `currentPollingIntervalMilliseconds`. Manual roles still register process
229
+ ownership and must be stopped. Prefer `runtime.run()` in production and
230
+ `runtime.testing` in tests.
185
231
 
186
232
  `InProcessWakeUpAdapter`, `WakeUpAdapter`, `WakeUpRole`, `WakeUpWatch`, and
187
233
  `WakeUpWaitOptions` define the notification extension. A watch must be obtained
188
234
  before checking durable state so a notification cannot fall between claim and
189
- wait.
235
+ wait. `WakeUpWatch.wait()` returns `true` for a notification and `false` for a
236
+ timeout or cancellation. A legacy `void` result remains accepted and preserves
237
+ the fast polling cadence.
190
238
 
191
239
  ### Errors
192
240
 
@@ -25,7 +25,9 @@ Each role takes a generation watch before checking for work. A post-commit
25
25
  wake-up therefore cannot fall into the gap between an empty claim and the
26
26
  worker's wait. The default adapter broadcasts within one process; polling
27
27
  remains active as the durable fallback and custom adapters can bridge process
28
- boundaries.
28
+ boundaries. Empty passes double the role's wait up to the configured idle
29
+ ceiling. Work or a notification resets it to the fast interval, and an actor
30
+ worker's ceiling never exceeds its lease-renewal interval.
29
31
 
30
32
  Each runtime role occupies a supervised factory slot. An unexpected promise
31
33
  resolution or rejection cleans up that instance, waits with capped exponential
@@ -63,7 +65,8 @@ per runtime listens on role-specific channels before the worker checks durable
63
65
  state, which closes the listener-startup race without holding a polling
64
66
  connection per worker. A notification advances a process-local role generation
65
67
  and wakes every matching waiter. Reconnection and notification loss fall back
66
- to the ordinary polling interval.
68
+ to adaptive polling, whose current wait can be as long as the configured idle
69
+ ceiling.
67
70
 
68
71
  The optional Redis adapter provides the same role generations through Pub/Sub
69
72
  for deployments that already operate Redis. It keeps commands and subscriptions
@@ -3,6 +3,46 @@
3
3
  The benchmark harness measures committed actor operations. It is intended to
4
4
  show tradeoffs and catch large regressions, not to predict application capacity.
5
5
 
6
+ ## Idle polling
7
+
8
+ The idle harness measures process CPU and empty database passes for the four
9
+ runtime roles:
10
+
11
+ ```bash
12
+ pnpm run benchmark:idle
13
+ ```
14
+
15
+ It warms each interval for three seconds, measures for ten seconds, and reports
16
+ process user plus system CPU time divided by wall time.
17
+
18
+ Measured on August 16, 2026 on an Apple M5 with Node.js 26.7.0 and in-memory
19
+ SQLite. The before run used 0.13.0; the after run used the prepared 0.13.1 tree.
20
+ Each run started one actor, effect, reminder, and broadcast role.
21
+
22
+ | Fast interval | Before polls/s | Before CPU | After polls/s | After CPU |
23
+ | ------------: | -------------: | ---------: | ------------: | --------: |
24
+ | 20 ms | 188.78 | 3.254% | 4.000 | 0.129% |
25
+ | 100 ms | 39.596 | 0.906% | 3.999 | 0.121% |
26
+ | 500 ms | 7.999 | 0.251% | 3.999 | 0.104% |
27
+
28
+ The after run reached the one-second ceiling for all four roles. These are
29
+ developer-laptop measurements, not a CPU guarantee; timer scheduling, JIT,
30
+ database path, and unrelated host activity affect short samples.
31
+
32
+ Five SQLite samples measured durable enqueue through committed completion after
33
+ 2.5 seconds of idleness. The polling-only multi-process harness submits just
34
+ after an empty pass, so it measures approximately the full polling wait rather
35
+ than average arrival latency.
36
+
37
+ | Topology | 0.13.0 p50 | Prepared 0.13.1 p50 |
38
+ | ------------------------------- | ---------: | ------------------: |
39
+ | One process, in-process wake-up | 2.589 ms | 2.662 ms |
40
+ | Two processes, polling only | 107.945 ms | 1,006.232 ms |
41
+
42
+ The local wake-up keeps the one-process path prompt after backoff. The
43
+ polling-only row is the explicit tradeoff: use PostgreSQL notifications or
44
+ optional Redis Pub/Sub when separate processes need low-latency delivery.
45
+
6
46
  ## Scenarios
7
47
 
8
48
  - `warm-hot`: all operations target one previously created identity.
@@ -11,6 +11,7 @@ through `runtime.ref(ActorClass, actorId)`. Both validate options immediately.
11
11
  | `database` | required | A `Database` adapter. |
12
12
  | `tableNamePrefix` | `"solid_objects_"` | Lowercase letters, digits, and underscores; must start with a letter. |
13
13
  | `pollingIntervalMilliseconds` | `100` | Positive durable-work polling interval. |
14
+ | `idlePollingIntervalMilliseconds` | `1_000` | Positive ceiling after consecutive empty polling passes. |
14
15
  | `syncPollingIntervalMilliseconds` | `50` | Positive result-wait polling interval. |
15
16
  | `leaseDurationMilliseconds` | `30_000` | Positive activation lease; must exceed renewal interval. |
16
17
  | `leaseRenewalIntervalMilliseconds` | `10_000` | Positive activation renewal cadence. |
@@ -52,8 +53,16 @@ affected failure path rather than schedule an invalid timestamp.
52
53
 
53
54
  Counts may be zero, but the complete configuration must leave at least one
54
55
  runtime role enabled. Broadcast workers are started only when `broadcast` or
55
- `authorizeSubscription` is configured. Wake-ups reduce latency; durable polling
56
- remains the correctness path.
56
+ `authorizeSubscription` is configured.
57
+
58
+ `pollingIntervalMilliseconds` is the fast interval after work or a wake-up.
59
+ Consecutive empty passes double it up to
60
+ `idlePollingIntervalMilliseconds`. Actor workers never wait longer than
61
+ `leaseRenewalIntervalMilliseconds`. Set the fast and idle values equal for a
62
+ fixed cadence. A custom wake-up adapter should return `true` for a notification
63
+ and `false` for a timeout; an older adapter that returns `void` remains
64
+ compatible and keeps the fast cadence. Wake-ups reduce latency, while database
65
+ polling remains the correctness path.
57
66
 
58
67
  ## Retention and cleanup
59
68
 
@@ -1,12 +1,38 @@
1
1
  # Operations
2
2
 
3
- Runtime roles use durable polling as the correctness fallback. The default
4
- generation-based wake-up adapter interrupts waits for new actor messages,
5
- effects, reminders, and broadcasts in the same Node process. Notification
6
- errors are isolated and logged by role and error class without failing the
7
- committed work. Graceful shutdown stops new claims and allows active turns to
8
- finish within `shutdownTimeoutMilliseconds`, which defaults to 15 seconds. A
9
- component still running or stopping at the deadline emits
3
+ Runtime roles use durable polling as the correctness fallback. Consecutive
4
+ empty passes double each role's wait from `pollingIntervalMilliseconds` to
5
+ `idlePollingIntervalMilliseconds`, which defaults to one second. Processed
6
+ work and wake-up notifications reset the role to the fast interval. Actor
7
+ workers clamp the ceiling to `leaseRenewalIntervalMilliseconds` while they may
8
+ hold cached activations.
9
+
10
+ The default generation-based wake-up adapter interrupts waits for new actor
11
+ messages, effects, reminders, and broadcasts in the same Node process. It does
12
+ not cross a process boundary. When live processes share the database without a
13
+ configured adapter, the runtime logs
14
+ `solid_objects.polling_only_cross_process_wake_up` once. Use PostgreSQL
15
+ notifications or optional Redis Pub/Sub when separate processes need prompt
16
+ delivery; without one, newly committed work can wait up to the current idle
17
+ polling interval. Notification errors are isolated and logged by role and error
18
+ class without failing the committed work.
19
+
20
+ The warning excludes process rows with the current hostname and host process ID.
21
+ It can therefore appear during a rolling deployment or restart overlap when an
22
+ older and newer process briefly share the same database. A process that stopped
23
+ without graceful cleanup remains live until its heartbeat exceeds
24
+ `processAliveThresholdMilliseconds`; inspect
25
+ `runtime.administration.processes()` to distinguish a live overlap from a stale
26
+ row.
27
+
28
+ Each role exposes `currentPollingIntervalMilliseconds`.
29
+ `solid_objects.polling.interval_changed` reports the role, reason, previous
30
+ interval, and current interval. The polling-only warning is also emitted as
31
+ `solid_objects.polling.only_cross_process_wake_up` instrumentation.
32
+
33
+ Graceful shutdown stops new claims and allows active turns to finish within
34
+ `shutdownTimeoutMilliseconds`, which defaults to 15 seconds. A component still
35
+ running or stopping at the deadline emits
10
36
  `solid_objects.supervisor.component_shutdown_timeout`; the runtime then returns
11
37
  without pretending JavaScript code was forcibly terminated. Operators should
12
38
  monitor oldest ready work, claimed work, dead letters, effect failures,
@@ -44,9 +70,12 @@ runs under the application-write guard, and `onDeactivate()` is best effort:
44
70
  it may not run after a crash, cannot establish a correctness guarantee, and a
45
71
  failure is logged without preventing lease release.
46
72
 
47
- `runtime.processes.all()` returns administration-authorized immutable process
48
- metadata with hostname, host process ID, Node and Solid Objects versions, and a
49
- current `stale` flag. Graceful shutdown first persists `draining` with a
73
+ `runtime.administration.processes()` returns the same administration-authorized
74
+ immutable process metadata as `runtime.processes.all()`, with hostname, host
75
+ process ID, Node and Solid Objects versions, and a current `stale` flag. It is
76
+ safe to call through the runtime's database adapter while workers are running;
77
+ the query is serialized with other database access and does not require a
78
+ second SQLite connection. Graceful shutdown first persists `draining` with a
50
79
  `shutdownRequestedAt` timestamp, then deactivates owned actors and atomically
51
80
  releases every role claim before persisting `stopped`. `cleanup()` reauthorizes
52
81
  separately and performs the same release for stale running or draining
package/docs/parity.md CHANGED
@@ -4,11 +4,11 @@ This ledger tracks capability parity with the Ruby `solid_objects` gem.
4
4
  Parity means preserving a capability and its correctness or security boundary,
5
5
  not copying a Rails API into Node.
6
6
 
7
- Reference: Ruby `solid_objects` 0.13.0. The JavaScript package began at the
7
+ Reference: Ruby `solid_objects` 0.13.2. The JavaScript package began at the
8
8
  Ruby design's `0.12` capability generation; that version number did not imply
9
9
  earlier JavaScript releases.
10
10
 
11
- The Node `0.13.0` implementation has capability parity with that reference. Its
11
+ The Node `0.13.2` implementation has capability parity with that reference. Its
12
12
  relational runtime, correctness boundaries, administration, diagnostics,
13
13
  operator dashboard, realtime projections, browser behavior, and supported
14
14
  adapters have native equivalents. Rails-specific rendering surfaces are
package/docs/releasing.md CHANGED
@@ -38,8 +38,8 @@ npm trust github solid-objects \
38
38
  4. Create and push an annotated tag matching the package version:
39
39
 
40
40
  ```shell
41
- git tag -a v0.13.0 -m "Version 0.13.0"
42
- git push origin v0.13.0
41
+ git tag -a v0.13.2 -m "Version 0.13.2"
42
+ git push origin v0.13.2
43
43
  ```
44
44
 
45
45
  The tag runs the complete CI matrix. The publish job starts only after every
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-objects",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "Race-free realtime state per application identity, backed by your SQL database",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -85,6 +85,7 @@
85
85
  "test:redis": "vitest run test/redis-wake-up.test.ts",
86
86
  "test:watch": "vitest",
87
87
  "benchmark": "pnpm run build && node benchmarks/run.ts",
88
+ "benchmark:idle": "pnpm run build && node benchmarks/idle.ts",
88
89
  "pack:check": "pnpm pack --dry-run && node scripts/check-package.mjs",
89
90
  "prepack": "pnpm run build"
90
91
  },