@ai-matrx/content-ir 0.19.20 → 0.19.21
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/CHANGELOG.md +5 -0
- package/dist/core.cjs +13 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +13 -23
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +13 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -23
- package/dist/index.js.map +1 -1
- package/dist/session.cjs +13 -23
- package/dist/session.cjs.map +1 -1
- package/dist/session.js +13 -23
- package/dist/session.js.map +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1266,7 +1266,7 @@ var KindStreamParser = class {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
if (!declaredKind && committedKind && this.speculativeKinds.has(pathKey)) {
|
|
1268
1268
|
this.speculativeKinds.delete(pathKey);
|
|
1269
|
-
this.finalizeSpeculatedObject(path, objectValue, committedKind, at);
|
|
1269
|
+
this.finalizeSpeculatedObject(path, objectValue, committedKind, at, true);
|
|
1270
1270
|
return;
|
|
1271
1271
|
}
|
|
1272
1272
|
if (path.length === 0 && !declaredKind && !committedKind && this.rootSurfaceKind) {
|
|
@@ -1344,7 +1344,7 @@ var KindStreamParser = class {
|
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
/** Validate + complete an object typed purely by parent prediction. */
|
|
1347
|
-
finalizeSpeculatedObject(path, objectValue, kind, at) {
|
|
1347
|
+
finalizeSpeculatedObject(path, objectValue, kind, at, requireSharedField = false) {
|
|
1348
1348
|
const schema = this.lookupSchema(kind);
|
|
1349
1349
|
if (!schema) {
|
|
1350
1350
|
this.emitRawObject(
|
|
@@ -1357,6 +1357,15 @@ var KindStreamParser = class {
|
|
|
1357
1357
|
);
|
|
1358
1358
|
return;
|
|
1359
1359
|
}
|
|
1360
|
+
if (requireSharedField && !Object.keys(objectValue).some((key) => key in schema.fields)) {
|
|
1361
|
+
this.emitRawObject(
|
|
1362
|
+
path,
|
|
1363
|
+
objectValue,
|
|
1364
|
+
`Object carries none of "${kind}"'s fields.`,
|
|
1365
|
+
at
|
|
1366
|
+
);
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1360
1369
|
const outcome = this.validateObjectAgainstSchema(
|
|
1361
1370
|
{ ...objectValue, [KIND_KEY]: kind },
|
|
1362
1371
|
schema
|
|
@@ -1617,16 +1626,7 @@ var KindStreamParser = class {
|
|
|
1617
1626
|
...emptyOutcome
|
|
1618
1627
|
};
|
|
1619
1628
|
}
|
|
1620
|
-
for (const
|
|
1621
|
-
if (fieldSchema.required) {
|
|
1622
|
-
if (!(fieldName in objectValue)) {
|
|
1623
|
-
return {
|
|
1624
|
-
error: `Kind "${schema.kind}" is missing required field "${fieldName}".`,
|
|
1625
|
-
...emptyOutcome
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
continue;
|
|
1629
|
-
}
|
|
1629
|
+
for (const fieldName of Object.keys(schema.fields)) {
|
|
1630
1630
|
if (!(fieldName in objectValue)) {
|
|
1631
1631
|
optionalMissing.push(fieldName);
|
|
1632
1632
|
}
|
|
@@ -1833,17 +1833,7 @@ var KindStreamParser = class {
|
|
|
1833
1833
|
validateObjectAgainstFields(objectValue, fields) {
|
|
1834
1834
|
const optionalMissing = [];
|
|
1835
1835
|
const extraFields = [];
|
|
1836
|
-
const
|
|
1837
|
-
for (const [fieldName, fieldSchema] of Object.entries(fields)) {
|
|
1838
|
-
if (fieldSchema.required) {
|
|
1839
|
-
if (!(fieldName in objectValue)) {
|
|
1840
|
-
return {
|
|
1841
|
-
error: `Inline object is missing required field "${fieldName}".`,
|
|
1842
|
-
...emptyOutcome
|
|
1843
|
-
};
|
|
1844
|
-
}
|
|
1845
|
-
continue;
|
|
1846
|
-
}
|
|
1836
|
+
for (const fieldName of Object.keys(fields)) {
|
|
1847
1837
|
if (!(fieldName in objectValue)) {
|
|
1848
1838
|
optionalMissing.push(fieldName);
|
|
1849
1839
|
}
|