@almadar/runtime 6.68.0 → 6.70.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/{OrbitalServerRuntime-DOJDoqXu.d.ts → OrbitalServerRuntime-ut1b36Nv.d.ts} +6 -0
- package/dist/OrbitalServerRuntime.d.ts +1 -1
- package/dist/OrbitalServerRuntime.js +25 -5
- package/dist/{chunk-XSWRK6DN.js → chunk-PAEMYGKV.js} +36 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +13 -5
- package/package.json +4 -4
|
@@ -1553,6 +1553,12 @@ declare class OrbitalServerRuntime {
|
|
|
1553
1553
|
interval: number | string;
|
|
1554
1554
|
hasGuard: boolean;
|
|
1555
1555
|
}>;
|
|
1556
|
+
/** Halt every registered tick's shared clock. Delegates to `TickScheduler.pause`. */
|
|
1557
|
+
pauseTicks(): void;
|
|
1558
|
+
/** Resume ticks halted by `pauseTicks()`. Delegates to `TickScheduler.resume`. */
|
|
1559
|
+
resumeTicks(): void;
|
|
1560
|
+
/** True while ticks are paused. Delegates to `TickScheduler.isPaused`. */
|
|
1561
|
+
areTicksPaused(): boolean;
|
|
1556
1562
|
}
|
|
1557
1563
|
/**
|
|
1558
1564
|
* Factory function to create a runtime instance
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'express';
|
|
2
|
-
export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-
|
|
2
|
+
export { F as ClientEffectTuple, G as ClientNavigateBackTuple, H as ClientNavigateTuple, J as ClientNotifyTuple, K as ClientRenderUITuple, M as EffectResult, e as InMemoryPersistence, N as LiveBroadcastItem, Q as LoaderConfig, O as OrbitalEventRequest, f as OrbitalEventResponse, T as OrbitalServerRuntime, g as OrbitalServerRuntimeConfig, P as PersistenceAdapter, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, V as RuntimeTraitTick, p as collectDeclaredConfigDefaults, W as createOrbitalServerRuntime } from './OrbitalServerRuntime-ut1b36Nv.js';
|
|
3
3
|
import './types-BaD_ox7e.js';
|
|
4
4
|
import '@almadar/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-
|
|
2
|
-
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-
|
|
1
|
+
import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-PAEMYGKV.js';
|
|
2
|
+
export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-PAEMYGKV.js';
|
|
3
3
|
import { isValidCronExpression } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import { createContextFromBindings, checkMutationAccess, resolveCallSitePayloadCaptures, applyRowAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
|
|
5
5
|
import './chunk-T4VDAB4C.js';
|
|
@@ -63,7 +63,7 @@ var dynamicLog = createLogger("almadar:runtime:dynamic");
|
|
|
63
63
|
function isNodeEnv() {
|
|
64
64
|
return typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
65
65
|
}
|
|
66
|
-
var NO_ROW_KEY_IS_FATAL =
|
|
66
|
+
var NO_ROW_KEY_IS_FATAL = true;
|
|
67
67
|
function needsPreprocessing(schema) {
|
|
68
68
|
for (const orbital of schema.orbitals) {
|
|
69
69
|
const uses = orbital.uses;
|
|
@@ -1575,7 +1575,11 @@ var OrbitalServerRuntime = class {
|
|
|
1575
1575
|
resultData = updated || { id: updateId, ...data || {} };
|
|
1576
1576
|
} else {
|
|
1577
1577
|
effectLog.error("persist:no-row-key", { action, entityType: type });
|
|
1578
|
-
if (NO_ROW_KEY_IS_FATAL)
|
|
1578
|
+
if (NO_ROW_KEY_IS_FATAL) {
|
|
1579
|
+
throw new Error(
|
|
1580
|
+
`persist ${action} ${type} resolved no row key \u2014 the id was neither on the row being written nor on the request. Bind it before the write, e.g. (set @entity.id ?row.id) on the transition that selects it.`
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1579
1583
|
}
|
|
1580
1584
|
break;
|
|
1581
1585
|
case "delete": {
|
|
@@ -1594,7 +1598,11 @@ var OrbitalServerRuntime = class {
|
|
|
1594
1598
|
resultData = { id: deleteId, deleted: true };
|
|
1595
1599
|
} else {
|
|
1596
1600
|
effectLog.error("persist:no-row-key", { action, entityType: type });
|
|
1597
|
-
if (NO_ROW_KEY_IS_FATAL)
|
|
1601
|
+
if (NO_ROW_KEY_IS_FATAL) {
|
|
1602
|
+
throw new Error(
|
|
1603
|
+
`persist ${action} ${type} resolved no row key \u2014 the id was neither on the row being written nor on the request. Bind it before the write, e.g. (set @entity.id ?row.id) on the transition that selects it.`
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1598
1606
|
}
|
|
1599
1607
|
break;
|
|
1600
1608
|
}
|
|
@@ -2410,6 +2418,18 @@ var OrbitalServerRuntime = class {
|
|
|
2410
2418
|
hasGuard: !!binding.tick.guard
|
|
2411
2419
|
}));
|
|
2412
2420
|
}
|
|
2421
|
+
/** Halt every registered tick's shared clock. Delegates to `TickScheduler.pause`. */
|
|
2422
|
+
pauseTicks() {
|
|
2423
|
+
this.tickScheduler.pause();
|
|
2424
|
+
}
|
|
2425
|
+
/** Resume ticks halted by `pauseTicks()`. Delegates to `TickScheduler.resume`. */
|
|
2426
|
+
resumeTicks() {
|
|
2427
|
+
this.tickScheduler.resume();
|
|
2428
|
+
}
|
|
2429
|
+
/** True while ticks are paused. Delegates to `TickScheduler.isPaused`. */
|
|
2430
|
+
areTicksPaused() {
|
|
2431
|
+
return this.tickScheduler.isPaused;
|
|
2432
|
+
}
|
|
2413
2433
|
};
|
|
2414
2434
|
function createOrbitalServerRuntime(config) {
|
|
2415
2435
|
return new OrbitalServerRuntime(config);
|
|
@@ -133,6 +133,7 @@ var TickScheduler = class {
|
|
|
133
133
|
ticks = /* @__PURE__ */ new Map();
|
|
134
134
|
nextId = 1;
|
|
135
135
|
running = false;
|
|
136
|
+
paused = false;
|
|
136
137
|
frameHandle = null;
|
|
137
138
|
hasRaf;
|
|
138
139
|
constructor() {
|
|
@@ -192,8 +193,38 @@ var TickScheduler = class {
|
|
|
192
193
|
this.ticks.clear();
|
|
193
194
|
this.maybeStop();
|
|
194
195
|
}
|
|
196
|
+
/** True while the scheduler is paused (no tick callback fires and no backlog accumulates). */
|
|
197
|
+
get isPaused() {
|
|
198
|
+
return this.paused;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Halt the shared loop without dropping registered ticks. No `onDue`
|
|
202
|
+
* fires again until `resume()`. A no-op if already paused.
|
|
203
|
+
*/
|
|
204
|
+
pause() {
|
|
205
|
+
if (this.paused) return;
|
|
206
|
+
this.paused = true;
|
|
207
|
+
this.stopLoop();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Restart the shared loop after `pause()`. Every registered tick's phase
|
|
211
|
+
* is reset (`lastTimestamp = null`) so the paused duration is never
|
|
212
|
+
* counted as elapsed time — the same "first pass just captures the
|
|
213
|
+
* timestamp" behavior a freshly `add()`-ed tick gets, which is what keeps
|
|
214
|
+
* resume from bursting a backlog of missed beats. A no-op if not paused.
|
|
215
|
+
*/
|
|
216
|
+
resume() {
|
|
217
|
+
if (!this.paused) return;
|
|
218
|
+
this.paused = false;
|
|
219
|
+
for (const tick of this.ticks.values()) {
|
|
220
|
+
tick.lastTimestamp = null;
|
|
221
|
+
}
|
|
222
|
+
if (this.ticks.size > 0) {
|
|
223
|
+
this.ensureRunning();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
195
226
|
ensureRunning() {
|
|
196
|
-
if (this.running) return;
|
|
227
|
+
if (this.running || this.paused) return;
|
|
197
228
|
this.running = true;
|
|
198
229
|
if (this.hasRaf) {
|
|
199
230
|
const loop = (timestamp) => {
|
|
@@ -208,6 +239,10 @@ var TickScheduler = class {
|
|
|
208
239
|
}
|
|
209
240
|
maybeStop() {
|
|
210
241
|
if (this.ticks.size > 0 || !this.running) return;
|
|
242
|
+
this.stopLoop();
|
|
243
|
+
}
|
|
244
|
+
/** Cancel the active rAF/interval loop, if any, and clear the running flag. */
|
|
245
|
+
stopLoop() {
|
|
211
246
|
this.running = false;
|
|
212
247
|
if (this.frameHandle !== null) {
|
|
213
248
|
if (this.hasRaf) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as RuntimePatternValue, B as BindingContext, f as EvaluationContextExtensions, P as PatternProps, E as EffectHandlers, h as EffectContext, i as ExecutionEnvironment, j as EffectResult, S as ServiceCallContext, T as TraitDefinition } from './types-BaD_ox7e.js';
|
|
2
2
|
export { k as BrowserFileMeta, l as BrowserFilePickerOptions, m as BrowserGeolocationOptions, n as BrowserGeolocationPosition, C as ConfigContext, o as Effect, a as EventListener, H as HANDLER_MANIFEST, I as IEventBus, b as RuntimeConfig, R as RuntimeEvent, d as TraitState, c as TransitionObserver, e as TransitionResult, U as Unsubscribe } from './types-BaD_ox7e.js';
|
|
3
|
-
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-
|
|
4
|
-
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-
|
|
3
|
+
import { U as UnifiedLoaderOptions, S as SchemaLoader, I as ImportChainLike, L as LoadResult, a as LoadedSchema, b as LoadedOrbital, P as PersistenceAdapter } from './OrbitalServerRuntime-ut1b36Nv.js';
|
|
4
|
+
export { E as EntitySharingMap, c as EventBus, d as EventNamespaceMap, e as InMemoryPersistence, O as OrbitalEventRequest, f as OrbitalEventResponse, g as OrbitalServerRuntimeConfig, h as PreprocessOptions, i as PreprocessResult, j as PreprocessedSchema, k as ProcessEventOptions, R as RegisteredOrbital, l as RuntimeOrbital, m as RuntimeOrbitalSchema, n as RuntimeTrait, o as StateMachineManager, p as collectDeclaredConfigDefaults, q as collectDeclaredEntityDefaults, r as createInitialTraitState, s as findInitialState, t as findTransition, u as getIsolatedCollectionName, v as getNamespacedEvent, w as isBrowser, x as isElectron, y as isNamespacedEvent, z as isNode, A as normalizeEventKey, B as parseNamespacedEvent, C as preprocessSchema, D as processEvent } from './OrbitalServerRuntime-ut1b36Nv.js';
|
|
5
5
|
import { EvaluationContext, SExpressionEvaluator } from '@almadar/evaluator';
|
|
6
6
|
export { EvaluationContext, createMinimalContext } from '@almadar/evaluator';
|
|
7
7
|
import { RenderBindingMarker, SExpr, RuntimeValue, TraitConfigObject, EventPayload, PatternConfig, EntityId, EntityField, EntityRow, EntityPersistence, ServiceParams, EntityAccessPolicies, PayloadField, OrbitalDefinition, OrbitalSchema } from '@almadar/core';
|
|
@@ -168,6 +168,7 @@ declare class TickScheduler {
|
|
|
168
168
|
private ticks;
|
|
169
169
|
private nextId;
|
|
170
170
|
private running;
|
|
171
|
+
private paused;
|
|
171
172
|
private frameHandle;
|
|
172
173
|
private readonly hasRaf;
|
|
173
174
|
constructor();
|
|
@@ -187,8 +188,25 @@ declare class TickScheduler {
|
|
|
187
188
|
addCron(expression: string, onDue: () => void): TickHandle;
|
|
188
189
|
/** Stop every tick and the shared loop. */
|
|
189
190
|
stopAll(): void;
|
|
191
|
+
/** True while the scheduler is paused (no tick callback fires and no backlog accumulates). */
|
|
192
|
+
get isPaused(): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Halt the shared loop without dropping registered ticks. No `onDue`
|
|
195
|
+
* fires again until `resume()`. A no-op if already paused.
|
|
196
|
+
*/
|
|
197
|
+
pause(): void;
|
|
198
|
+
/**
|
|
199
|
+
* Restart the shared loop after `pause()`. Every registered tick's phase
|
|
200
|
+
* is reset (`lastTimestamp = null`) so the paused duration is never
|
|
201
|
+
* counted as elapsed time — the same "first pass just captures the
|
|
202
|
+
* timestamp" behavior a freshly `add()`-ed tick gets, which is what keeps
|
|
203
|
+
* resume from bursting a backlog of missed beats. A no-op if not paused.
|
|
204
|
+
*/
|
|
205
|
+
resume(): void;
|
|
190
206
|
private ensureRunning;
|
|
191
207
|
private maybeStop;
|
|
208
|
+
/** Cancel the active rAF/interval loop, if any, and clear the running flag. */
|
|
209
|
+
private stopLoop;
|
|
192
210
|
private advance;
|
|
193
211
|
/** Cron ticks check calendar-match at most once a second, deduped per matching minute. */
|
|
194
212
|
private advanceCron;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EffectExecutor } from './chunk-
|
|
2
|
-
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-
|
|
1
|
+
import { EffectExecutor } from './chunk-PAEMYGKV.js';
|
|
2
|
+
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-PAEMYGKV.js';
|
|
3
3
|
export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
|
|
4
4
|
import { createContextFromBindings, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
|
|
5
5
|
export { CALLSITE_PAYLOAD_PREFIX, applyRowAccess, checkMutationAccess, containsBindings, createContextFromBindings, createMinimalContext, deferEntityBindings, extractBindings, interpolateProps, interpolateValue, resolveCallSitePayloadCaptures } from './chunk-ZJ62H3ES.js';
|
|
@@ -179,7 +179,7 @@ function createClientEffectHandlers(options) {
|
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
var NO_ROW_KEY_IS_FATAL =
|
|
182
|
+
var NO_ROW_KEY_IS_FATAL = true;
|
|
183
183
|
var effectLog = createLogger("almadar:runtime:effects");
|
|
184
184
|
function createServerEffectHandlers(opts) {
|
|
185
185
|
const {
|
|
@@ -384,7 +384,11 @@ function createServerEffectHandlers(opts) {
|
|
|
384
384
|
resultData = updated ?? { id: idOrFallback, ...row };
|
|
385
385
|
} else {
|
|
386
386
|
effectLog.error("persist:no-row-key", { action, entityType: type });
|
|
387
|
-
if (NO_ROW_KEY_IS_FATAL)
|
|
387
|
+
if (NO_ROW_KEY_IS_FATAL) {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`persist ${action} ${type} resolved no row key \u2014 the id was neither on the row being written nor on the request. Bind it before the write, e.g. (set @entity.id ?row.id) on the transition that selects it.`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
388
392
|
}
|
|
389
393
|
break;
|
|
390
394
|
}
|
|
@@ -403,7 +407,11 @@ function createServerEffectHandlers(opts) {
|
|
|
403
407
|
resultData = { id: deleteId, deleted: true };
|
|
404
408
|
} else {
|
|
405
409
|
effectLog.error("persist:no-row-key", { action, entityType: type });
|
|
406
|
-
if (NO_ROW_KEY_IS_FATAL)
|
|
410
|
+
if (NO_ROW_KEY_IS_FATAL) {
|
|
411
|
+
throw new Error(
|
|
412
|
+
`persist ${action} ${type} resolved no row key \u2014 the id was neither on the row being written nor on the request. Bind it before the write, e.g. (set @entity.id ?row.id) on the transition that selects it.`
|
|
413
|
+
);
|
|
414
|
+
}
|
|
407
415
|
}
|
|
408
416
|
break;
|
|
409
417
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/runtime",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.70.0",
|
|
4
4
|
"description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@almadar/core": "^10.
|
|
61
|
-
"@almadar/evaluator": "^2.
|
|
60
|
+
"@almadar/core": "^10.83.0",
|
|
61
|
+
"@almadar/evaluator": "^2.44.0",
|
|
62
62
|
"@almadar/logger": "^1.12.0",
|
|
63
63
|
"@almadar/server": "^2.39.0",
|
|
64
|
-
"@almadar/std": "^16.
|
|
64
|
+
"@almadar/std": "^16.203.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"express": "^5.0.0"
|