@korajs/core 1.0.0-beta.5 → 1.0.0-beta.7
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/bindings/index.d.cts +2 -2
- package/dist/bindings/index.d.ts +2 -2
- package/dist/{build-scope-map-K25AyQXb.d.cts → build-scope-map-Bm6Lqo9F.d.cts} +1 -1
- package/dist/{build-scope-map-BvdTzmm4.d.ts → build-scope-map-C60lT-4I.d.ts} +1 -1
- package/dist/{events-DhblJN4r.d.cts → events-CT9y24ht.d.cts} +12 -0
- package/dist/{events-DhblJN4r.d.ts → events-CT9y24ht.d.ts} +12 -0
- package/dist/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{operation-D-pemjcf.d.cts → operation-BxQjKMvK.d.cts} +1 -1
- package/dist/{operation-CC7O3-wf.d.ts → operation-C9BEVSX4.d.ts} +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RandomSource, B as BlobRef, C as CollectionDefinition, A as AtomicOpType, a as AtomicOp, F as FieldBuilder, b as CustomResolver, M as MigrationDefinition, S as SchemaDefinition, c as RelationDefinition, O as OperationType, E as EnumFieldBuilder, J as JsonFieldBuilder, d as ArrayFieldBuilder, e as FieldKind, f as Operation, V as VersionVector, g as MigrationStep, h as StateMachineConstraint, T as TransitionMap, i as TransitionValidationResult } from './events-
|
|
2
|
-
export { j as CONNECTION_QUALITIES, k as ConnectionQuality, l as Constraint, m as FieldDescriptor, n as FieldMergeStrategy, H as HLCTimestamp, K as KoraEvent, o as KoraEventByType, p as KoraEventEmitter, q as KoraEventListener, r as KoraEventType, s as MERGE_STRATEGIES, t as MergeStrategy, u as MergeTrace, v as MigrationBuilder, w as OnDeleteAction, x as OperationInput, y as RelationType, z as RollbackBuilder, D as SecretMode, G as SequenceConfig, I as StateMachineDefinition, L as SyncDiagnosticsSnapshot, N as SyncRuleDefinition, P as TimeSource, Q as migrate, U as t } from './events-
|
|
3
|
-
export { H as HybridLogicalClock, M as MAX_LOGICAL, c as createOperation, i as isValidOperation, v as verifyOperationIntegrity } from './operation-
|
|
4
|
-
export { S as ScopeMap, b as buildScopeMap } from './build-scope-map-
|
|
1
|
+
import { R as RandomSource, B as BlobRef, C as CollectionDefinition, A as AtomicOpType, a as AtomicOp, F as FieldBuilder, b as CustomResolver, M as MigrationDefinition, S as SchemaDefinition, c as RelationDefinition, O as OperationType, E as EnumFieldBuilder, J as JsonFieldBuilder, d as ArrayFieldBuilder, e as FieldKind, f as Operation, V as VersionVector, g as MigrationStep, h as StateMachineConstraint, T as TransitionMap, i as TransitionValidationResult } from './events-CT9y24ht.cjs';
|
|
2
|
+
export { j as CONNECTION_QUALITIES, k as ConnectionQuality, l as Constraint, m as FieldDescriptor, n as FieldMergeStrategy, H as HLCTimestamp, K as KoraEvent, o as KoraEventByType, p as KoraEventEmitter, q as KoraEventListener, r as KoraEventType, s as MERGE_STRATEGIES, t as MergeStrategy, u as MergeTrace, v as MigrationBuilder, w as OnDeleteAction, x as OperationInput, y as RelationType, z as RollbackBuilder, D as SecretMode, G as SequenceConfig, I as StateMachineDefinition, L as SyncDiagnosticsSnapshot, N as SyncRuleDefinition, P as TimeSource, Q as migrate, U as t } from './events-CT9y24ht.cjs';
|
|
3
|
+
export { H as HybridLogicalClock, M as MAX_LOGICAL, c as createOperation, i as isValidOperation, v as verifyOperationIntegrity } from './operation-BxQjKMvK.cjs';
|
|
4
|
+
export { S as ScopeMap, b as buildScopeMap } from './build-scope-map-Bm6Lqo9F.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Base error class for all Kora errors.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RandomSource, B as BlobRef, C as CollectionDefinition, A as AtomicOpType, a as AtomicOp, F as FieldBuilder, b as CustomResolver, M as MigrationDefinition, S as SchemaDefinition, c as RelationDefinition, O as OperationType, E as EnumFieldBuilder, J as JsonFieldBuilder, d as ArrayFieldBuilder, e as FieldKind, f as Operation, V as VersionVector, g as MigrationStep, h as StateMachineConstraint, T as TransitionMap, i as TransitionValidationResult } from './events-
|
|
2
|
-
export { j as CONNECTION_QUALITIES, k as ConnectionQuality, l as Constraint, m as FieldDescriptor, n as FieldMergeStrategy, H as HLCTimestamp, K as KoraEvent, o as KoraEventByType, p as KoraEventEmitter, q as KoraEventListener, r as KoraEventType, s as MERGE_STRATEGIES, t as MergeStrategy, u as MergeTrace, v as MigrationBuilder, w as OnDeleteAction, x as OperationInput, y as RelationType, z as RollbackBuilder, D as SecretMode, G as SequenceConfig, I as StateMachineDefinition, L as SyncDiagnosticsSnapshot, N as SyncRuleDefinition, P as TimeSource, Q as migrate, U as t } from './events-
|
|
3
|
-
export { H as HybridLogicalClock, M as MAX_LOGICAL, c as createOperation, i as isValidOperation, v as verifyOperationIntegrity } from './operation-
|
|
4
|
-
export { S as ScopeMap, b as buildScopeMap } from './build-scope-map-
|
|
1
|
+
import { R as RandomSource, B as BlobRef, C as CollectionDefinition, A as AtomicOpType, a as AtomicOp, F as FieldBuilder, b as CustomResolver, M as MigrationDefinition, S as SchemaDefinition, c as RelationDefinition, O as OperationType, E as EnumFieldBuilder, J as JsonFieldBuilder, d as ArrayFieldBuilder, e as FieldKind, f as Operation, V as VersionVector, g as MigrationStep, h as StateMachineConstraint, T as TransitionMap, i as TransitionValidationResult } from './events-CT9y24ht.js';
|
|
2
|
+
export { j as CONNECTION_QUALITIES, k as ConnectionQuality, l as Constraint, m as FieldDescriptor, n as FieldMergeStrategy, H as HLCTimestamp, K as KoraEvent, o as KoraEventByType, p as KoraEventEmitter, q as KoraEventListener, r as KoraEventType, s as MERGE_STRATEGIES, t as MergeStrategy, u as MergeTrace, v as MigrationBuilder, w as OnDeleteAction, x as OperationInput, y as RelationType, z as RollbackBuilder, D as SecretMode, G as SequenceConfig, I as StateMachineDefinition, L as SyncDiagnosticsSnapshot, N as SyncRuleDefinition, P as TimeSource, Q as migrate, U as t } from './events-CT9y24ht.js';
|
|
3
|
+
export { H as HybridLogicalClock, M as MAX_LOGICAL, c as createOperation, i as isValidOperation, v as verifyOperationIntegrity } from './operation-C9BEVSX4.js';
|
|
4
|
+
export { S as ScopeMap, b as buildScopeMap } from './build-scope-map-C60lT-4I.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Base error class for all Kora errors.
|
package/dist/index.js
CHANGED
|
@@ -1773,10 +1773,17 @@ function validateFieldValue(collection, fieldName, descriptor, value) {
|
|
|
1773
1773
|
break;
|
|
1774
1774
|
}
|
|
1775
1775
|
case "json": {
|
|
1776
|
-
|
|
1776
|
+
const nonJson = findNonJsonSerializable(value, fieldName);
|
|
1777
|
+
if (nonJson) {
|
|
1777
1778
|
throw new SchemaValidationError(
|
|
1778
|
-
`Field "${fieldName}" in collection "${collection}" must be JSON-serializable
|
|
1779
|
-
{
|
|
1779
|
+
`Field "${fieldName}" in collection "${collection}" must be JSON-serializable; found ${nonJson.receivedType} at "${nonJson.path}"`,
|
|
1780
|
+
{
|
|
1781
|
+
collection,
|
|
1782
|
+
field: fieldName,
|
|
1783
|
+
expectedType: "json",
|
|
1784
|
+
receivedType: nonJson.receivedType,
|
|
1785
|
+
path: nonJson.path
|
|
1786
|
+
}
|
|
1780
1787
|
);
|
|
1781
1788
|
}
|
|
1782
1789
|
break;
|
|
@@ -1813,21 +1820,41 @@ function isPlainObject(value) {
|
|
|
1813
1820
|
const proto = Object.getPrototypeOf(value);
|
|
1814
1821
|
return proto === null || proto === Object.prototype;
|
|
1815
1822
|
}
|
|
1816
|
-
function
|
|
1823
|
+
function findNonJsonSerializable(value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
1817
1824
|
if (value === null) {
|
|
1818
|
-
return
|
|
1825
|
+
return null;
|
|
1819
1826
|
}
|
|
1820
1827
|
const type = typeof value;
|
|
1821
1828
|
if (type === "string" || type === "number" || type === "boolean") {
|
|
1822
|
-
|
|
1829
|
+
if (type === "number" && !Number.isFinite(value)) {
|
|
1830
|
+
return { path, receivedType: describeType(value) };
|
|
1831
|
+
}
|
|
1832
|
+
return null;
|
|
1833
|
+
}
|
|
1834
|
+
if (type === "undefined" || type === "function" || type === "symbol" || type === "bigint") {
|
|
1835
|
+
return { path, receivedType: describeType(value) };
|
|
1823
1836
|
}
|
|
1824
1837
|
if (Array.isArray(value)) {
|
|
1825
|
-
|
|
1838
|
+
for (let index = 0; index < value.length; index++) {
|
|
1839
|
+
const invalid = findNonJsonSerializable(value[index], `${path}[${index}]`, seen);
|
|
1840
|
+
if (invalid) return invalid;
|
|
1841
|
+
}
|
|
1842
|
+
return null;
|
|
1826
1843
|
}
|
|
1827
1844
|
if (type === "object") {
|
|
1828
|
-
|
|
1845
|
+
const objectValue = value;
|
|
1846
|
+
if (seen.has(objectValue)) {
|
|
1847
|
+
return { path, receivedType: "circular object" };
|
|
1848
|
+
}
|
|
1849
|
+
seen.add(objectValue);
|
|
1850
|
+
for (const [key, nestedValue] of Object.entries(objectValue)) {
|
|
1851
|
+
const invalid = findNonJsonSerializable(nestedValue, `${path}.${key}`, seen);
|
|
1852
|
+
if (invalid) return invalid;
|
|
1853
|
+
}
|
|
1854
|
+
seen.delete(objectValue);
|
|
1855
|
+
return null;
|
|
1829
1856
|
}
|
|
1830
|
-
return
|
|
1857
|
+
return { path, receivedType: describeType(value) };
|
|
1831
1858
|
}
|
|
1832
1859
|
function describeType(value) {
|
|
1833
1860
|
if (value === null) {
|