@almadar/runtime 5.2.0 → 5.4.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.js +19 -2
- package/dist/OrbitalServerRuntime.js.map +1 -1
- package/dist/{chunk-OG2NHXES.js → chunk-62BIUDUH.js} +46 -16
- package/dist/chunk-62BIUDUH.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-OG2NHXES.js.map +0 -1
|
@@ -195,18 +195,32 @@ function interpolateProps(props, ctx) {
|
|
|
195
195
|
}
|
|
196
196
|
const entityBindingRaw = props["entity"];
|
|
197
197
|
const typeBindingRaw = props["type"];
|
|
198
|
+
const patternType = typeof typeBindingRaw === "string" ? typeBindingRaw : void 0;
|
|
198
199
|
if (typeof entityBindingRaw === "string") {
|
|
199
200
|
const resolvedEntity = result["entity"];
|
|
200
201
|
const resolvedRow = resolvedEntity !== null && typeof resolvedEntity === "object" && !Array.isArray(resolvedEntity) ? resolvedEntity : null;
|
|
201
202
|
const ctxRow = ctx.payload["row"];
|
|
202
203
|
renderLog.debug("interpolateProps:entity", {
|
|
203
|
-
patternType
|
|
204
|
+
patternType,
|
|
204
205
|
entityBinding: entityBindingRaw,
|
|
205
206
|
resolvedIsObject: resolvedRow !== null,
|
|
206
207
|
resolvedEqualsCtxRow: ctxRow !== void 0 && resolvedRow !== null && resolvedRow === ctxRow,
|
|
207
208
|
resolvedRowId: resolvedRow?.id
|
|
208
209
|
});
|
|
209
210
|
}
|
|
211
|
+
if (patternType === "form-section" || patternType === "form") {
|
|
212
|
+
const modeRaw = result["mode"];
|
|
213
|
+
const submitRaw = result["submitEvent"];
|
|
214
|
+
const cancelRaw = result["cancelEvent"];
|
|
215
|
+
bindLog.debug("form-binding", {
|
|
216
|
+
patternType,
|
|
217
|
+
mode: typeof modeRaw === "string" ? modeRaw : void 0,
|
|
218
|
+
submitEvent: typeof submitRaw === "string" ? submitRaw : void 0,
|
|
219
|
+
cancelEvent: typeof cancelRaw === "string" ? cancelRaw : void 0,
|
|
220
|
+
entity: JSON.stringify(result["entity"] ?? null),
|
|
221
|
+
fields: JSON.stringify(result["fields"] ?? null)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
210
224
|
return anyChanged ? result : props;
|
|
211
225
|
}
|
|
212
226
|
function interpolateValue(value, ctx) {
|
|
@@ -1670,6 +1684,9 @@ function buildEmitsFromTraits(traits, explicitEmits) {
|
|
|
1670
1684
|
}
|
|
1671
1685
|
return result;
|
|
1672
1686
|
}
|
|
1687
|
+
var mockLog = createLogger("almadar:runtime:mock");
|
|
1688
|
+
var DEFAULT_MOCK_SEED = 42;
|
|
1689
|
+
var SEED_REFERENCE_TIMESTAMP = "2024-01-01T00:00:00.000Z";
|
|
1673
1690
|
var MockPersistenceAdapter = class {
|
|
1674
1691
|
stores = /* @__PURE__ */ new Map();
|
|
1675
1692
|
schemas = /* @__PURE__ */ new Map();
|
|
@@ -1679,13 +1696,20 @@ var MockPersistenceAdapter = class {
|
|
|
1679
1696
|
this.config = {
|
|
1680
1697
|
defaultSeedCount: 6,
|
|
1681
1698
|
debug: false,
|
|
1699
|
+
seed: DEFAULT_MOCK_SEED,
|
|
1682
1700
|
...config
|
|
1683
1701
|
};
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1702
|
+
faker.seed(this.config.seed);
|
|
1703
|
+
mockLog.debug("mock:adapter:init", { seed: this.config.seed });
|
|
1704
|
+
}
|
|
1705
|
+
/** Re-anchor faker's PRNG to the configured seed. Called before every
|
|
1706
|
+
* re-seed loop so identical reseed sequences produce identical rows
|
|
1707
|
+
* (timestamps + faker-generated fields). Without this, the first
|
|
1708
|
+
* reseed produces row set A, the second produces row set B, and
|
|
1709
|
+
* diff observers see all rows as "changed" between frames. */
|
|
1710
|
+
resetFakerSeed() {
|
|
1711
|
+
if (this.config.seed !== void 0) {
|
|
1712
|
+
faker.seed(this.config.seed);
|
|
1689
1713
|
}
|
|
1690
1714
|
}
|
|
1691
1715
|
// ============================================================================
|
|
@@ -1733,12 +1757,11 @@ var MockPersistenceAdapter = class {
|
|
|
1733
1757
|
}
|
|
1734
1758
|
for (const instance of instances) {
|
|
1735
1759
|
const id = instance.id || this.nextId(entityName);
|
|
1736
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1737
1760
|
const item = {
|
|
1738
1761
|
...instance,
|
|
1739
1762
|
id,
|
|
1740
|
-
createdAt: instance.createdAt ||
|
|
1741
|
-
updatedAt:
|
|
1763
|
+
createdAt: instance.createdAt || SEED_REFERENCE_TIMESTAMP,
|
|
1764
|
+
updatedAt: SEED_REFERENCE_TIMESTAMP
|
|
1742
1765
|
};
|
|
1743
1766
|
store.set(id, item);
|
|
1744
1767
|
}
|
|
@@ -1752,21 +1775,26 @@ var MockPersistenceAdapter = class {
|
|
|
1752
1775
|
if (this.config.debug) {
|
|
1753
1776
|
console.log(`[MockPersistence] Seeding ${count} ${entityName}...`);
|
|
1754
1777
|
}
|
|
1778
|
+
const generated = [];
|
|
1755
1779
|
for (let i = 0; i < count; i++) {
|
|
1756
1780
|
const item = this.generateMockItem(normalized, entityName, fields, i + 1);
|
|
1757
1781
|
store.set(item.id, item);
|
|
1782
|
+
generated.push({
|
|
1783
|
+
id: item.id,
|
|
1784
|
+
updatedAt: typeof item.updatedAt === "string" ? item.updatedAt : ""
|
|
1785
|
+
});
|
|
1758
1786
|
}
|
|
1787
|
+
mockLog.debug("mock:seed", { entityName, count, idsAndTimestamps: JSON.stringify(generated) });
|
|
1759
1788
|
}
|
|
1760
1789
|
/**
|
|
1761
1790
|
* Generate a single mock item based on field schemas.
|
|
1762
1791
|
*/
|
|
1763
1792
|
generateMockItem(normalizedName, entityName, fields, index) {
|
|
1764
1793
|
const id = this.nextId(entityName);
|
|
1765
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1766
1794
|
const item = {
|
|
1767
1795
|
id,
|
|
1768
1796
|
createdAt: faker.date.past({ years: 1 }).toISOString(),
|
|
1769
|
-
updatedAt:
|
|
1797
|
+
updatedAt: SEED_REFERENCE_TIMESTAMP
|
|
1770
1798
|
};
|
|
1771
1799
|
for (const field of fields) {
|
|
1772
1800
|
if (field.name === "id" || field.name === "createdAt" || field.name === "updatedAt") {
|
|
@@ -1932,12 +1960,14 @@ var MockPersistenceAdapter = class {
|
|
|
1932
1960
|
this.stores.delete(normalized);
|
|
1933
1961
|
this.idCounters.delete(normalized);
|
|
1934
1962
|
}
|
|
1935
|
-
/**
|
|
1936
|
-
*
|
|
1937
|
-
*/
|
|
1963
|
+
/** Clear all data + re-anchor faker so the next seed loop reproduces
|
|
1964
|
+
* identical rows. Hermetic-frame mode calls this between every step
|
|
1965
|
+
* via OrbitalServerRuntime.resetMockPersistence. */
|
|
1938
1966
|
clearAll() {
|
|
1939
1967
|
this.stores.clear();
|
|
1940
1968
|
this.idCounters.clear();
|
|
1969
|
+
this.resetFakerSeed();
|
|
1970
|
+
mockLog.debug("mock:adapter:clearAll", { reanchored: this.config.seed });
|
|
1941
1971
|
}
|
|
1942
1972
|
/**
|
|
1943
1973
|
* Get count of items for an entity.
|
|
@@ -3382,5 +3412,5 @@ var InMemoryPersistence = class {
|
|
|
3382
3412
|
};
|
|
3383
3413
|
|
|
3384
3414
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, buildEmitsFromTraits, containsBindings, createContextFromBindings, createInitialTraitState, createLogger, createMockPersistence, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes };
|
|
3385
|
-
//# sourceMappingURL=chunk-
|
|
3386
|
-
//# sourceMappingURL=chunk-
|
|
3415
|
+
//# sourceMappingURL=chunk-62BIUDUH.js.map
|
|
3416
|
+
//# sourceMappingURL=chunk-62BIUDUH.js.map
|