@korajs/core 1.0.0-beta.13 → 1.0.0-beta.14
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-ClIq_doj.d.cts → build-scope-map-C9zBTJ1R.d.cts} +1 -1
- package/dist/{build-scope-map-CIFa58oA.d.ts → build-scope-map-CZaMyZLV.d.ts} +1 -1
- package/dist/{events-BSU-0z5O.d.cts → events-Da29Dt_3.d.cts} +2 -2
- package/dist/{events-BSU-0z5O.d.ts → events-Da29Dt_3.d.ts} +2 -2
- package/dist/index.cjs +22 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/{sql-gen-DdOkMojr.d.cts → sql-gen-BOeuiyqu.d.cts} +1 -1
- package/dist/{sql-gen-ByOZIQU-.d.ts → sql-gen-CXTA6w-w.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { X as KoraEventEmitter } from '../events-
|
|
2
|
-
import { S as ScopeMap } from '../build-scope-map-
|
|
1
|
+
import { X as KoraEventEmitter } from '../events-Da29Dt_3.cjs';
|
|
2
|
+
import { S as ScopeMap } from '../build-scope-map-C9zBTJ1R.cjs';
|
|
3
3
|
|
|
4
4
|
/** Sync status shape consumed by framework binding hooks (matches {@link SyncStatusInfo} in `@korajs/sync`). */
|
|
5
5
|
interface KoraBindingSyncStatus {
|
package/dist/bindings/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { X as KoraEventEmitter } from '../events-
|
|
2
|
-
import { S as ScopeMap } from '../build-scope-map-
|
|
1
|
+
import { X as KoraEventEmitter } from '../events-Da29Dt_3.js';
|
|
2
|
+
import { S as ScopeMap } from '../build-scope-map-CZaMyZLV.js';
|
|
3
3
|
|
|
4
4
|
/** Sync status shape consumed by framework binding hooks (matches {@link SyncStatusInfo} in `@korajs/sync`). */
|
|
5
5
|
interface KoraBindingSyncStatus {
|
|
@@ -1315,8 +1315,8 @@ type KoraEvent = {
|
|
|
1315
1315
|
} | {
|
|
1316
1316
|
/**
|
|
1317
1317
|
* A sync peer speaks an older, deprecated protocol version (protocol v2): a
|
|
1318
|
-
* server emits it for a protocol-1 client (Kora <= beta.12), accepted
|
|
1319
|
-
* beta.13
|
|
1318
|
+
* server emits it for a protocol-1 client (Kora <= beta.12), accepted with this
|
|
1319
|
+
* deprecation in beta.13 and beta.14. `message` says what to upgrade.
|
|
1320
1320
|
*/
|
|
1321
1321
|
type: 'sync:protocol-deprecated';
|
|
1322
1322
|
nodeId: string;
|
|
@@ -1315,8 +1315,8 @@ type KoraEvent = {
|
|
|
1315
1315
|
} | {
|
|
1316
1316
|
/**
|
|
1317
1317
|
* A sync peer speaks an older, deprecated protocol version (protocol v2): a
|
|
1318
|
-
* server emits it for a protocol-1 client (Kora <= beta.12), accepted
|
|
1319
|
-
* beta.13
|
|
1318
|
+
* server emits it for a protocol-1 client (Kora <= beta.12), accepted with this
|
|
1319
|
+
* deprecation in beta.13 and beta.14. `message` says what to upgrade.
|
|
1320
1320
|
*/
|
|
1321
1321
|
type: 'sync:protocol-deprecated';
|
|
1322
1322
|
nodeId: string;
|
package/dist/index.cjs
CHANGED
|
@@ -3594,6 +3594,22 @@ function validateConstraint(collection, constraint, fields) {
|
|
|
3594
3594
|
);
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
|
+
if (constraint.where !== void 0 && constraint.type !== "referential") {
|
|
3598
|
+
for (const [key, value] of Object.entries(constraint.where)) {
|
|
3599
|
+
if (key !== "id" && !(key in fields)) {
|
|
3600
|
+
throw new SchemaValidationError(
|
|
3601
|
+
`Constraint where references field "${key}" which does not exist in collection "${collection}". Available fields: ${Object.keys(fields).join(", ")}`,
|
|
3602
|
+
{ collection, field: key }
|
|
3603
|
+
);
|
|
3604
|
+
}
|
|
3605
|
+
if (value !== null && typeof value === "object") {
|
|
3606
|
+
throw new SchemaValidationError(
|
|
3607
|
+
`Constraint where on "${collection}.${key}" uses ${Array.isArray(value) ? "an array" : `the operator object ${JSON.stringify(value)}`}, but constraint where matches by plain equality only, so the constraint would never apply. Use an equality value (for example { ${key}: 'published' }), or enforce the rule in validateOperation or a server route.`,
|
|
3608
|
+
{ collection, field: key }
|
|
3609
|
+
);
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3597
3613
|
if (constraint.onConflict === "priority-field" && !constraint.priorityField) {
|
|
3598
3614
|
throw new SchemaValidationError(
|
|
3599
3615
|
`Constraint with "priority-field" onConflict strategy in collection "${collection}" requires a priorityField`,
|
|
@@ -4689,10 +4705,13 @@ function isPlainObject3(value) {
|
|
|
4689
4705
|
const proto = Object.getPrototypeOf(value);
|
|
4690
4706
|
return proto === null || proto === Object.prototype;
|
|
4691
4707
|
}
|
|
4692
|
-
function findNonJsonSerializable(value, path, seen = /* @__PURE__ */ new WeakSet()) {
|
|
4708
|
+
function findNonJsonSerializable(value, path, seen = /* @__PURE__ */ new WeakSet(), nested = false) {
|
|
4693
4709
|
if (value === null) {
|
|
4694
4710
|
return null;
|
|
4695
4711
|
}
|
|
4712
|
+
if (value === void 0 && nested) {
|
|
4713
|
+
return null;
|
|
4714
|
+
}
|
|
4696
4715
|
const type = typeof value;
|
|
4697
4716
|
if (type === "string" || type === "number" || type === "boolean") {
|
|
4698
4717
|
if (type === "number" && !Number.isFinite(value)) {
|
|
@@ -4705,7 +4724,7 @@ function findNonJsonSerializable(value, path, seen = /* @__PURE__ */ new WeakSet
|
|
|
4705
4724
|
}
|
|
4706
4725
|
if (Array.isArray(value)) {
|
|
4707
4726
|
for (let index = 0; index < value.length; index++) {
|
|
4708
|
-
const invalid = findNonJsonSerializable(value[index], `${path}[${index}]`, seen);
|
|
4727
|
+
const invalid = findNonJsonSerializable(value[index], `${path}[${index}]`, seen, true);
|
|
4709
4728
|
if (invalid) return invalid;
|
|
4710
4729
|
}
|
|
4711
4730
|
return null;
|
|
@@ -4717,7 +4736,7 @@ function findNonJsonSerializable(value, path, seen = /* @__PURE__ */ new WeakSet
|
|
|
4717
4736
|
}
|
|
4718
4737
|
seen.add(objectValue);
|
|
4719
4738
|
for (const [key, nestedValue] of Object.entries(objectValue)) {
|
|
4720
|
-
const invalid = findNonJsonSerializable(nestedValue, `${path}.${key}`, seen);
|
|
4739
|
+
const invalid = findNonJsonSerializable(nestedValue, `${path}.${key}`, seen, true);
|
|
4721
4740
|
if (invalid) return invalid;
|
|
4722
4741
|
}
|
|
4723
4742
|
seen.delete(objectValue);
|