@ai-matrx/content-ir 0.19.21 → 0.19.26
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 +29 -0
- package/dist/convert.cjs +158 -6
- package/dist/convert.cjs.map +1 -1
- package/dist/convert.d.cts +71 -2
- package/dist/convert.d.ts +71 -2
- package/dist/convert.js +152 -7
- package/dist/convert.js.map +1 -1
- package/dist/core.cjs +19 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +19 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +159 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +152 -7
- package/dist/index.js.map +1 -1
- package/dist/registry.d.cts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/source.cjs +1 -0
- package/dist/source.d.cts +9 -1
- package/dist/source.d.ts +9 -1
- package/dist/source.js +1 -1
- package/dist/text-case.cjs +322 -0
- package/dist/text-case.cjs.map +1 -0
- package/dist/text-case.d.cts +81 -0
- package/dist/text-case.d.ts +81 -0
- package/dist/text-case.js +309 -0
- package/dist/text-case.js.map +1 -0
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +2 -2
- package/dist/wire.d.ts +2 -2
- package/dist/wire.js.map +1 -1
- package/package.json +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ export { CompleteValueEnvelopeOptions, CompliantKindSnapshot, ContentRegionInit,
|
|
|
4
4
|
export { A as ArrayItemScalarType, F as FieldSchema, K as KIND_KEY, a as KindSchema, R as RecordValueType, S as ScalarFieldType, i as isJsonAnyField, b as isScalarArrayType, r as readObjectKind, s as scalarArrayItemType } from './kind-schema.types-CwncWj9U.cjs';
|
|
5
5
|
export { ParseSession, ParseSessionOptions, disposeParseSession, getParseSession, openParseSession } from './session.cjs';
|
|
6
6
|
export { DualGateDefinition, DualGateInput, DualGateResolvedComponent, DualGateResult, Json, KindBlockProps, KindDefinition, KindEdgeSpec, KindStorageError, KindStorageShape, KindTier, KindValidationResult, KindValidator, KindValidatorOptions, LegResult, ROOT_STORAGE_NAME, SchemaSourcePort, SchemaUnavailableReason, StoredFieldElement, createKindValidator, describeDualGateFailure, kindSchemaToStorage, runKindDualGate, storageToKindSchema, validateStructuralLeg } from './registry.cjs';
|
|
7
|
-
export { ArrayItemKindBinding, BlockSchemaDraft, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonResult, SavePlanEntry, SavePlanValidation, SchemaConversionResult, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, validateBlockSchemaSavePlan } from './convert.cjs';
|
|
7
|
+
export { ArrayItemKindBinding, BlockSchemaDraft, CONTROL_KEYS, CONTROL_KEY_FIELDS, ControlKey, ControlKeysMode, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonOptions, KindSchemaFromJsonResult, RECORD_DISPOSITION, SavePlanEntry, SavePlanValidation, SchemaConversionResult, WithControlKeysOptions, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, controlKeysApplyTo, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, stripControlKeys, validateBlockSchemaSavePlan, withControlKeyFields, withControlKeys } from './convert.cjs';
|
|
8
8
|
export { AnyPartialKindEvent, IR_PARTIAL_KEY, KindVerdict, NODE_OUTCOME_KIND, NodeOutcomeWrapper, PartialKindEvent, PartialKindNode, PartialKindState, RUN_RESULT_KIND, RetractedKindEvent, RunResultWrapper, SupersededKindEvent, advancePartialKind, emitPayloadFence, emitPayloadJson, isProvisionalKind, isTerminalKindEvent, kindVerdictOf, makePartialKindStalenessGate, readNodeOutcomeValue, readOutputRef, readPartialKindEvent, readRunResultValue, rehydrateNodeOutcome, rehydrateRunResult, sanitizeInboundPartialKindMetadata, withRootKind } from './wire.cjs';
|
|
9
9
|
export { ACTION_BY_CLASS, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DecodedDirective, DirectiveCapability, DirectiveClass, DirectiveDecodeError, DirectiveDisplay, DirectiveItemKindLookup, DirectiveItemsEdge, DirectiveNounCatalog, DirectiveNounEntry, DirectiveSlug, IN_CONTENT_CLASSES, ItemFact, KindDirectiveShell, RESERVED_PREFIX, SIDE_EFFECT_CLASSES, SLUG_PREFIX, asKindInstance, buildDirectiveSlug, buildKindDirective, capabilityOf, decodeDirective, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, executesAtOutputRoot, isDirectiveClass, isKindDirective, isLegacyShell, isReservedDirectiveSlug, itemFacts, itemSubtitle, itemTitle, legacyShellUses, looksLikeDirectiveHead, nounFamily, nounLabel, nounTitleColumn, parseDirectiveSlug, resetLegacyShellUses, resolvesInContent, titleCaseToken, tryDecodeDirective, tryDecodeDirectiveContent } from './directives.cjs';
|
|
10
|
-
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.cjs';
|
|
10
|
+
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.cjs';
|
|
11
11
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { CompleteValueEnvelopeOptions, CompliantKindSnapshot, ContentRegionInit,
|
|
|
4
4
|
export { A as ArrayItemScalarType, F as FieldSchema, K as KIND_KEY, a as KindSchema, R as RecordValueType, S as ScalarFieldType, i as isJsonAnyField, b as isScalarArrayType, r as readObjectKind, s as scalarArrayItemType } from './kind-schema.types-CwncWj9U.js';
|
|
5
5
|
export { ParseSession, ParseSessionOptions, disposeParseSession, getParseSession, openParseSession } from './session.js';
|
|
6
6
|
export { DualGateDefinition, DualGateInput, DualGateResolvedComponent, DualGateResult, Json, KindBlockProps, KindDefinition, KindEdgeSpec, KindStorageError, KindStorageShape, KindTier, KindValidationResult, KindValidator, KindValidatorOptions, LegResult, ROOT_STORAGE_NAME, SchemaSourcePort, SchemaUnavailableReason, StoredFieldElement, createKindValidator, describeDualGateFailure, kindSchemaToStorage, runKindDualGate, storageToKindSchema, validateStructuralLeg } from './registry.js';
|
|
7
|
-
export { ArrayItemKindBinding, BlockSchemaDraft, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonResult, SavePlanEntry, SavePlanValidation, SchemaConversionResult, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, validateBlockSchemaSavePlan } from './convert.js';
|
|
7
|
+
export { ArrayItemKindBinding, BlockSchemaDraft, CONTROL_KEYS, CONTROL_KEY_FIELDS, ControlKey, ControlKeysMode, ConversionProblem, DroppedMetadata, FieldComparison, ItemKindRefCheck, JsonSchemaNode, KindJsonSchemaExport, KindJsonSchemaOptions, KindSchemaFromJsonOptions, KindSchemaFromJsonResult, RECORD_DISPOSITION, SavePlanEntry, SavePlanValidation, SchemaConversionResult, WithControlKeysOptions, buildAgentSchemaWithRenderBlockSupport, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, controlKeysApplyTo, convertAiSchemaToBlockFields, fieldsToDbPayload, injectKindIntoObjectSchema, isDuplicateBlockSlug, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, normalizeAiSchemaInput, runSchemaConversion, stripControlKeys, validateBlockSchemaSavePlan, withControlKeyFields, withControlKeys } from './convert.js';
|
|
8
8
|
export { AnyPartialKindEvent, IR_PARTIAL_KEY, KindVerdict, NODE_OUTCOME_KIND, NodeOutcomeWrapper, PartialKindEvent, PartialKindNode, PartialKindState, RUN_RESULT_KIND, RetractedKindEvent, RunResultWrapper, SupersededKindEvent, advancePartialKind, emitPayloadFence, emitPayloadJson, isProvisionalKind, isTerminalKindEvent, kindVerdictOf, makePartialKindStalenessGate, readNodeOutcomeValue, readOutputRef, readPartialKindEvent, readRunResultValue, rehydrateNodeOutcome, rehydrateRunResult, sanitizeInboundPartialKindMetadata, withRootKind } from './wire.js';
|
|
9
9
|
export { ACTION_BY_CLASS, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DecodedDirective, DirectiveCapability, DirectiveClass, DirectiveDecodeError, DirectiveDisplay, DirectiveItemKindLookup, DirectiveItemsEdge, DirectiveNounCatalog, DirectiveNounEntry, DirectiveSlug, IN_CONTENT_CLASSES, ItemFact, KindDirectiveShell, RESERVED_PREFIX, SIDE_EFFECT_CLASSES, SLUG_PREFIX, asKindInstance, buildDirectiveSlug, buildKindDirective, capabilityOf, decodeDirective, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, executesAtOutputRoot, isDirectiveClass, isKindDirective, isLegacyShell, isReservedDirectiveSlug, itemFacts, itemSubtitle, itemTitle, legacyShellUses, looksLikeDirectiveHead, nounFamily, nounLabel, nounTitleColumn, parseDirectiveSlug, resetLegacyShellUses, resolvesInContent, titleCaseToken, tryDecodeDirective, tryDecodeDirectiveContent } from './directives.js';
|
|
10
|
-
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.js';
|
|
10
|
+
export { AFTER_WINDOW, BacktickRuns, BlockIslandType, CALLOUT_NAMES, CodePointIndex, CodeRange, DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceEnd, FenceLineKind, FenceLines, FenceOpener, FenceReader, InlineIslandType, InnerFenceLine, IslandMeta, IslandType, LinkDefinition, MapOptions, MappedPosition, MappedRange, NESTING_FENCE_LANGUAGES, ReadXmlTag, SourceBlock, SourceBlockKind, SourceChange, SourceEdit, SourceIsland, SourceSpan, SourceSpliceError, SourceSpliceErrorCode, SpliceIntegrity, SpliceOptions, SpliceResult, TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, normalizeLinkLabel, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readXmlTag, resolveReferenceLinks, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes } from './source.js';
|
|
11
11
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -2122,7 +2122,7 @@ function stripKindDeep(value) {
|
|
|
2122
2122
|
return value;
|
|
2123
2123
|
}
|
|
2124
2124
|
|
|
2125
|
-
//
|
|
2125
|
+
// text-case.ts
|
|
2126
2126
|
var DEFAULT_WORD_REPLACEMENTS = {
|
|
2127
2127
|
// Acronyms & initialisms
|
|
2128
2128
|
"api": "API",
|
|
@@ -2390,6 +2390,24 @@ function formatText(text, options = {}) {
|
|
|
2390
2390
|
}
|
|
2391
2391
|
return result;
|
|
2392
2392
|
}
|
|
2393
|
+
var IDENTIFIER_ACRONYMS = [
|
|
2394
|
+
"ID",
|
|
2395
|
+
"URL",
|
|
2396
|
+
"PDF",
|
|
2397
|
+
"HTML",
|
|
2398
|
+
"JSON",
|
|
2399
|
+
"API",
|
|
2400
|
+
"AI",
|
|
2401
|
+
"UI",
|
|
2402
|
+
"CSV",
|
|
2403
|
+
"SMS",
|
|
2404
|
+
"SEO",
|
|
2405
|
+
"LLM",
|
|
2406
|
+
"MCP",
|
|
2407
|
+
"UUID",
|
|
2408
|
+
"ISO"
|
|
2409
|
+
];
|
|
2410
|
+
new Set(IDENTIFIER_ACRONYMS.map((a) => a.toLowerCase()));
|
|
2393
2411
|
|
|
2394
2412
|
// core/schema-structure.ts
|
|
2395
2413
|
function formatBlockLabel(key) {
|
|
@@ -3182,13 +3200,13 @@ function makeKindJsonSchemaProperty(kindSlug, strict) {
|
|
|
3182
3200
|
return { ...base2, enum: [kindSlug] };
|
|
3183
3201
|
}
|
|
3184
3202
|
function injectKindIntoObjectSchema(objectSchema, kindSlug, strict) {
|
|
3185
|
-
const
|
|
3186
|
-
const properties = isRecord4(
|
|
3203
|
+
const clone2 = deepClone(objectSchema);
|
|
3204
|
+
const properties = isRecord4(clone2.properties) ? { ...clone2.properties } : {};
|
|
3187
3205
|
properties[KIND_KEY] = makeKindJsonSchemaProperty(kindSlug, strict);
|
|
3188
|
-
const required = Array.isArray(
|
|
3206
|
+
const required = Array.isArray(clone2.required) ? clone2.required.filter((k) => typeof k === "string") : [];
|
|
3189
3207
|
const nextRequired = required.includes(KIND_KEY) ? required : [KIND_KEY, ...required];
|
|
3190
3208
|
return {
|
|
3191
|
-
...
|
|
3209
|
+
...clone2,
|
|
3192
3210
|
properties,
|
|
3193
3211
|
required: nextRequired,
|
|
3194
3212
|
...strict ? { additionalProperties: false } : {}
|
|
@@ -4385,8 +4403,132 @@ function kindSchemaToJsonSchema(kind, resolve, options = {}) {
|
|
|
4385
4403
|
return { name: kind, schema: { ...rootNode, $defs: defs }, strict, unresolved };
|
|
4386
4404
|
}
|
|
4387
4405
|
|
|
4406
|
+
// convert/control-keys.ts
|
|
4407
|
+
var CONTROL_KEYS = ["_replaces", "_new", "_record_id", "_records"];
|
|
4408
|
+
var RECORD_DISPOSITION = "record";
|
|
4409
|
+
var KIND_KEY2 = "__kind";
|
|
4410
|
+
var DOCUMENT_KEYS = /* @__PURE__ */ new Set(["$schema", "$id", "$defs", "definitions", "title", "description"]);
|
|
4411
|
+
var CONTROL = new Set(CONTROL_KEYS);
|
|
4412
|
+
function controlKeysApplyTo(disposition) {
|
|
4413
|
+
return disposition === RECORD_DISPOSITION;
|
|
4414
|
+
}
|
|
4415
|
+
function clone(value) {
|
|
4416
|
+
return value === void 0 ? value : JSON.parse(JSON.stringify(value));
|
|
4417
|
+
}
|
|
4418
|
+
function isObjectSchema(schema) {
|
|
4419
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return false;
|
|
4420
|
+
const s = schema;
|
|
4421
|
+
return s.type === "object" && !!s.properties && typeof s.properties === "object" && !Array.isArray(s.properties);
|
|
4422
|
+
}
|
|
4423
|
+
function requiredOf(schema) {
|
|
4424
|
+
return Array.isArray(schema.required) ? schema.required : [];
|
|
4425
|
+
}
|
|
4426
|
+
function recordObject(schema) {
|
|
4427
|
+
const item = {};
|
|
4428
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
4429
|
+
if (!DOCUMENT_KEYS.has(k)) item[k] = clone(v);
|
|
4430
|
+
}
|
|
4431
|
+
const props = {};
|
|
4432
|
+
for (const [k, v] of Object.entries(item.properties)) {
|
|
4433
|
+
if (k !== KIND_KEY2 && !CONTROL.has(k)) props[k] = v;
|
|
4434
|
+
}
|
|
4435
|
+
item.properties = props;
|
|
4436
|
+
const required = requiredOf(item).filter((k) => k !== KIND_KEY2 && !CONTROL.has(k));
|
|
4437
|
+
if (required.length > 0) item.required = required;
|
|
4438
|
+
else delete item.required;
|
|
4439
|
+
return item;
|
|
4440
|
+
}
|
|
4441
|
+
function stored(schema) {
|
|
4442
|
+
const out = clone(schema);
|
|
4443
|
+
const item = recordObject(schema);
|
|
4444
|
+
const props = out.properties;
|
|
4445
|
+
props._replaces = { type: ["string", "null"], format: "uuid" };
|
|
4446
|
+
props._new = { type: ["boolean", "null"] };
|
|
4447
|
+
props._record_id = { type: ["string", "null"], format: "uuid" };
|
|
4448
|
+
props._records = { type: ["array", "null"], items: item };
|
|
4449
|
+
const rootRequired = requiredOf(out).filter((k) => !CONTROL.has(k));
|
|
4450
|
+
const lifted = rootRequired.filter((k) => k !== KIND_KEY2);
|
|
4451
|
+
if (lifted.length > 0) {
|
|
4452
|
+
const kept = rootRequired.filter((k) => k === KIND_KEY2);
|
|
4453
|
+
if (kept.length > 0) out.required = kept;
|
|
4454
|
+
else delete out.required;
|
|
4455
|
+
const branch = {
|
|
4456
|
+
if: {
|
|
4457
|
+
anyOf: [
|
|
4458
|
+
{ required: ["_record_id"], properties: { _record_id: { type: "string" } } },
|
|
4459
|
+
{ required: ["_records"], properties: { _records: { type: "array" } } }
|
|
4460
|
+
]
|
|
4461
|
+
},
|
|
4462
|
+
else: { required: lifted }
|
|
4463
|
+
};
|
|
4464
|
+
out.allOf = Array.isArray(out.allOf) ? [...out.allOf, branch] : [branch];
|
|
4465
|
+
}
|
|
4466
|
+
return out;
|
|
4467
|
+
}
|
|
4468
|
+
function authored(schema, many, allowEdit) {
|
|
4469
|
+
const signals = {
|
|
4470
|
+
_replaces: { type: "string", format: "uuid" },
|
|
4471
|
+
_new: { type: "boolean" }
|
|
4472
|
+
};
|
|
4473
|
+
if (allowEdit) signals._record_id = { type: "string", format: "uuid" };
|
|
4474
|
+
if (!many) {
|
|
4475
|
+
const out2 = clone(schema);
|
|
4476
|
+
Object.assign(out2.properties, clone(signals));
|
|
4477
|
+
const required = requiredOf(out2).filter((k) => !CONTROL.has(k));
|
|
4478
|
+
if (required.length > 0 || "required" in out2) out2.required = required;
|
|
4479
|
+
return out2;
|
|
4480
|
+
}
|
|
4481
|
+
const out = {};
|
|
4482
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
4483
|
+
if (DOCUMENT_KEYS.has(k)) out[k] = clone(v);
|
|
4484
|
+
}
|
|
4485
|
+
out.type = "object";
|
|
4486
|
+
const kindProp = schema.properties[KIND_KEY2];
|
|
4487
|
+
const properties = {};
|
|
4488
|
+
if (kindProp !== void 0) properties[KIND_KEY2] = clone(kindProp);
|
|
4489
|
+
properties._records = { type: "array", items: recordObject(schema) };
|
|
4490
|
+
Object.assign(properties, clone(signals));
|
|
4491
|
+
out.properties = properties;
|
|
4492
|
+
out.required = [KIND_KEY2, "_records"].filter((k) => k in properties);
|
|
4493
|
+
out.additionalProperties = false;
|
|
4494
|
+
return out;
|
|
4495
|
+
}
|
|
4496
|
+
function withControlKeys(schema, options) {
|
|
4497
|
+
const { mode, many = false, allowEdit = false } = options;
|
|
4498
|
+
if (mode !== "stored" && mode !== "authored") {
|
|
4499
|
+
throw new Error(`withControlKeys: mode must be "stored" or "authored", got ${String(mode)}`);
|
|
4500
|
+
}
|
|
4501
|
+
if (!isObjectSchema(schema)) return schema;
|
|
4502
|
+
return mode === "stored" ? stored(schema) : authored(schema, many, allowEdit);
|
|
4503
|
+
}
|
|
4504
|
+
var CONTROL_KEY_FIELDS = Object.freeze({
|
|
4505
|
+
_replaces: { type: "string", nullable: true },
|
|
4506
|
+
_new: { type: "boolean", nullable: true },
|
|
4507
|
+
_record_id: { type: "string", nullable: true },
|
|
4508
|
+
// A batch's items are records of this kind WITHOUT `__kind`; the render layer reads them
|
|
4509
|
+
// as opaque JSON (never stricter than the store, which validates each item).
|
|
4510
|
+
_records: { type: "json[]", nullable: true }
|
|
4511
|
+
});
|
|
4512
|
+
function withControlKeyFields(schema) {
|
|
4513
|
+
if (schema.root) return schema;
|
|
4514
|
+
const fields = { ...schema.fields };
|
|
4515
|
+
for (const key of CONTROL_KEYS) {
|
|
4516
|
+
if (!(key in fields)) fields[key] = { ...CONTROL_KEY_FIELDS[key] };
|
|
4517
|
+
}
|
|
4518
|
+
return { ...schema, fields };
|
|
4519
|
+
}
|
|
4520
|
+
function stripControlKeys(value) {
|
|
4521
|
+
const values = {};
|
|
4522
|
+
const signals = {};
|
|
4523
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4524
|
+
if (CONTROL.has(k)) signals[k] = v;
|
|
4525
|
+
else values[k] = v;
|
|
4526
|
+
}
|
|
4527
|
+
return { values, signals };
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4388
4530
|
// convert/json-schema-to-kind.ts
|
|
4389
|
-
function kindSchemaFromJsonSchema(kind, jsonSchema) {
|
|
4531
|
+
function kindSchemaFromJsonSchema(kind, jsonSchema, options = {}) {
|
|
4390
4532
|
if (jsonSchema === null || jsonSchema === void 0) {
|
|
4391
4533
|
return { schema: null, children: {}, problems: [] };
|
|
4392
4534
|
}
|
|
@@ -4417,6 +4559,9 @@ function kindSchemaFromJsonSchema(kind, jsonSchema) {
|
|
|
4417
4559
|
if (draft.slug === kind) schema = asKindSchema;
|
|
4418
4560
|
else children[draft.slug] = asKindSchema;
|
|
4419
4561
|
}
|
|
4562
|
+
if (schema && controlKeysApplyTo(options.disposition)) {
|
|
4563
|
+
schema = withControlKeyFields(schema);
|
|
4564
|
+
}
|
|
4420
4565
|
return { schema, children, problems: converted.problems };
|
|
4421
4566
|
}
|
|
4422
4567
|
|
|
@@ -7921,6 +8066,6 @@ function resolveReferenceLinks(fragment, defs) {
|
|
|
7921
8066
|
return resolved.replace(new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`, "g"), (_m, i) => spans[Number(i)] ?? "");
|
|
7922
8067
|
}
|
|
7923
8068
|
|
|
7924
|
-
export { ACTION_BY_CLASS, AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, CAPABILITY_BY_CLASS, CLASSES, DIRECTIVE_VERSION, DirectiveDecodeError, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, IN_CONTENT_CLASSES, IR_ENVELOPE_CACHE_VERSION, IR_ENVELOPE_KEY, IR_PARTIAL_KEY, IR_VERSION, IrTree, JSON_DISCRIMINATOR, JsonStreamTokenizer, KIND_KEY, KindStorageError, KindStreamParser, NESTING_FENCE_LANGUAGES, NODE_OUTCOME_KIND, ParseSession, RESERVED_PREFIX, ROOT_STORAGE_NAME, RUN_RESULT_KIND, SIDE_EFFECT_CLASSES, SLUG_PREFIX, SourceSpliceError, XmlContainerTracker, advancePartialKind, asKindInstance, blockAt, blockEdit, blockRangeEdit, buildAgentSchemaWithRenderBlockSupport, buildCodePointIndex, buildCompliantKindSnapshot, buildDirectiveSlug, buildKindDirective, capabilityOf, classifyInboundEnvelopeMetadata, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, continuesTable, convertAiSchemaToBlockFields, createFingerprinter, createKindStreamParser, createKindValidator, decodeDirective, describeDualGateFailure, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, disposeParseSession, emitPayloadFence, emitPayloadJson, emptyValueForFieldSchema, envelopeCacheFromEnvelopes, envelopeFromCompleteValue, executesAtOutputRoot, fenceDiscriminator, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, fieldsToDbPayload, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, fingerprintText, formatBlockLabel, getParseSession, injectKindIntoObjectSchema, irPathIsUnderOrEqual, irPathKey, irPathLabel, irPathsEqual, isCanonicalBlockIR, isDirectiveClass, isDuplicateBlockSlug, isEmptyResidue, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isIrEnvelopeCache, isJsonAnyField, isKindDirective, isLegacyShell, isMathPlaceholder, isPipeLedRow, isProvisionalKind, isReservedDirectiveSlug, isScalarArrayType, isSingleDollarMath, isTerminalKindEvent, islandEdit, itemFacts, itemSubtitle, itemTitle, joinSource, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, kindSchemaToStorage, kindVerdictOf, legacyShellUses, lineIndent, listIslands, looksLikeDirectiveHead, looksLikeDisplayMath, looksLikeOpenInlineMath, makePartialKindStalenessGate, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, mergeResidueIntoValue, normalizeAiSchemaInput, normalizeJsonRegion, normalizeLinkLabel, nounFamily, nounLabel, nounTitleColumn, openParseSession, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseDirectiveSlug, parseFenceOpener, pendingDisplayMathOpener, readEnvelope, readNodeOutcomeValue, readObjectKind, readOutputRef, readPartialKindEvent, readRunResultValue, readXmlTag, reconstructRegionValue, rehydrateNodeOutcome, rehydrateRunResult, resetLegacyShellUses, resolveReferenceLinks, resolvesInContent, reuseEnvelopeIfCurrent, rowCells, runKindDualGate, runSchemaConversion, sanitizeInboundEnvelopeMetadata, sanitizeInboundPartialKindMetadata, scalarArrayItemType, schemaLayoutMode, schemaStructureDepth, setJsonRootKeyLookup, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, storageToKindSchema, stripKindDeep, tableContainerIndent, tableStartsAt, titleCaseToken, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, tryDecodeDirective, tryDecodeDirectiveContent, unescapeCellPipes, validateBlockSchemaSavePlan, validateStructuralLeg, withRootKind, xmlDiscriminator };
|
|
8069
|
+
export { ACTION_BY_CLASS, AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, CAPABILITY_BY_CLASS, CLASSES, CONTROL_KEYS, CONTROL_KEY_FIELDS, DIRECTIVE_VERSION, DirectiveDecodeError, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, IN_CONTENT_CLASSES, IR_ENVELOPE_CACHE_VERSION, IR_ENVELOPE_KEY, IR_PARTIAL_KEY, IR_VERSION, IrTree, JSON_DISCRIMINATOR, JsonStreamTokenizer, KIND_KEY, KindStorageError, KindStreamParser, NESTING_FENCE_LANGUAGES, NODE_OUTCOME_KIND, ParseSession, RECORD_DISPOSITION, RESERVED_PREFIX, ROOT_STORAGE_NAME, RUN_RESULT_KIND, SIDE_EFFECT_CLASSES, SLUG_PREFIX, SourceSpliceError, XmlContainerTracker, advancePartialKind, asKindInstance, blockAt, blockEdit, blockRangeEdit, buildAgentSchemaWithRenderBlockSupport, buildCodePointIndex, buildCompliantKindSnapshot, buildDirectiveSlug, buildKindDirective, capabilityOf, classifyInboundEnvelopeMetadata, classifyInnerFenceLine, closeFence, codeSpanText, collectLinkDefinitions, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, continuesTable, controlKeysApplyTo, convertAiSchemaToBlockFields, createFingerprinter, createKindStreamParser, createKindValidator, decodeDirective, describeDualGateFailure, directiveDisplay, directiveItemKindFromEdges, directiveSlugOf, disposeParseSession, emitPayloadFence, emitPayloadJson, emptyValueForFieldSchema, envelopeCacheFromEnvelopes, envelopeFromCompleteValue, executesAtOutputRoot, fenceDiscriminator, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, fieldsToDbPayload, findCodeRanges, findInlineCodeSpans, findLinkDefinitionLines, findTableEnd, findTableStart, fingerprintText, formatBlockLabel, getParseSession, injectKindIntoObjectSchema, irPathIsUnderOrEqual, irPathKey, irPathLabel, irPathsEqual, isCanonicalBlockIR, isDirectiveClass, isDuplicateBlockSlug, isEmptyResidue, isEscapedBracketMath, isGfmDelimiterRow, isHtmlBlockTagName, isIrEnvelopeCache, isJsonAnyField, isKindDirective, isLegacyShell, isMathPlaceholder, isPipeLedRow, isProvisionalKind, isReservedDirectiveSlug, isScalarArrayType, isSingleDollarMath, isTerminalKindEvent, islandEdit, itemFacts, itemSubtitle, itemTitle, joinSource, kindSchemaFromJsonSchema, kindSchemaToJsonSchema, kindSchemaToStorage, kindVerdictOf, legacyShellUses, lineIndent, listIslands, looksLikeDirectiveHead, looksLikeDisplayMath, looksLikeOpenInlineMath, makePartialKindStalenessGate, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, mergeResidueIntoValue, normalizeAiSchemaInput, normalizeJsonRegion, normalizeLinkLabel, nounFamily, nounLabel, nounTitleColumn, openParseSession, opensStrippedHtmlBlock, opensTable, pairDisplayMath, parseDirectiveSlug, parseFenceOpener, pendingCodeSpanStart, pendingDisplayMathOpener, readEnvelope, readNodeOutcomeValue, readObjectKind, readOutputRef, readPartialKindEvent, readRunResultValue, readXmlTag, reconstructRegionValue, rehydrateNodeOutcome, rehydrateRunResult, resetLegacyShellUses, resolveReferenceLinks, resolvesInContent, reuseEnvelopeIfCurrent, rowCells, runKindDualGate, runSchemaConversion, sanitizeInboundEnvelopeMetadata, sanitizeInboundPartialKindMetadata, scalarArrayItemType, schemaLayoutMode, schemaStructureDepth, setJsonRootKeyLookup, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, storageToKindSchema, stripControlKeys, stripKindDeep, tableContainerIndent, tableStartsAt, titleCaseToken, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, tryDecodeDirective, tryDecodeDirectiveContent, unescapeCellPipes, validateBlockSchemaSavePlan, validateStructuralLeg, withControlKeyFields, withControlKeys, withRootKind, xmlDiscriminator };
|
|
7925
8070
|
//# sourceMappingURL=index.js.map
|
|
7926
8071
|
//# sourceMappingURL=index.js.map
|