raffel 1.1.111 → 1.1.112
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/docs/ui/assets/raffel-docs.css +17 -0
- package/dist/docs/ui/assets/raffel-docs.js +45 -4
- package/dist/docs/ui/runtime/index.js +45 -4
- package/dist/docs/ui/runtime/index.js.map +1 -1
- package/dist/docs/ui/style-sections/schema-code.d.ts +1 -1
- package/dist/docs/ui/style-sections/schema-code.d.ts.map +1 -1
- package/dist/docs/ui/style-sections/schema-code.js +17 -0
- package/dist/docs/ui/style-sections/schema-code.js.map +1 -1
- package/dist/server/builder.d.ts.map +1 -1
- package/dist/server/builder.js +1 -0
- package/dist/server/builder.js.map +1 -1
- package/dist/server/fs-routes/typescript-output-inference.d.ts.map +1 -1
- package/dist/server/fs-routes/typescript-output-inference.js +74 -10
- package/dist/server/fs-routes/typescript-output-inference.js.map +1 -1
- package/dist/server/types/protocol-namespace-types.d.ts +2 -0
- package/dist/server/types/protocol-namespace-types.d.ts.map +1 -1
- package/dist/ui/docs/ui/style-sections/schema-code.d.ts +1 -1
- package/dist/ui/docs/ui/style-sections/schema-code.d.ts.map +1 -1
- package/dist/ui/server/fs-routes/typescript-output-inference.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3370,6 +3370,23 @@
|
|
|
3370
3370
|
color: var(--text-secondary);
|
|
3371
3371
|
}
|
|
3372
3372
|
|
|
3373
|
+
.schema-composition-header {
|
|
3374
|
+
font-weight: 600;
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
.schema-composition-variant {
|
|
3378
|
+
margin: 8px 0 8px 12px;
|
|
3379
|
+
border-left: 2px solid color-mix(in srgb, var(--primary-color) 35%, var(--border-color));
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3382
|
+
.schema-composition-label {
|
|
3383
|
+
padding: 4px 8px;
|
|
3384
|
+
color: var(--text-secondary);
|
|
3385
|
+
font-size: 10px;
|
|
3386
|
+
font-weight: 600;
|
|
3387
|
+
text-transform: uppercase;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3373
3390
|
.schema-tree-unresolved {
|
|
3374
3391
|
color: var(--text-muted);
|
|
3375
3392
|
font-style: italic;
|
|
@@ -1545,8 +1545,29 @@ function collectContractExamples(owner, schema) {
|
|
|
1545
1545
|
return true;
|
|
1546
1546
|
});
|
|
1547
1547
|
}
|
|
1548
|
+
function schemaComposition(schema) {
|
|
1549
|
+
if (!schema || typeof schema !== 'object')
|
|
1550
|
+
return null;
|
|
1551
|
+
if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
|
|
1552
|
+
return { label: 'One of', variants: schema.oneOf };
|
|
1553
|
+
}
|
|
1554
|
+
if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
|
|
1555
|
+
return { label: 'Any of', variants: schema.anyOf };
|
|
1556
|
+
}
|
|
1557
|
+
if (Array.isArray(schema.allOf) && schema.allOf.length > 0) {
|
|
1558
|
+
return { label: 'All of', variants: schema.allOf };
|
|
1559
|
+
}
|
|
1560
|
+
return null;
|
|
1561
|
+
}
|
|
1548
1562
|
function contractSchemaType(rawSchema, schema) {
|
|
1549
1563
|
const refName = rawSchema?.$ref ? String(rawSchema.$ref).split('/').pop() : '';
|
|
1564
|
+
const composition = schemaComposition(schema);
|
|
1565
|
+
if (composition) {
|
|
1566
|
+
return {
|
|
1567
|
+
type: 'composition',
|
|
1568
|
+
label: `${composition.label.toLowerCase()} ${composition.variants.length} variants`,
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1550
1571
|
const type = Array.isArray(schema?.type)
|
|
1551
1572
|
? schema.type.join(' | ')
|
|
1552
1573
|
: schema?.type || (refName ? 'object' : 'any');
|
|
@@ -1580,11 +1601,13 @@ function appendContractExamples(parent, examples, prefix = '') {
|
|
|
1580
1601
|
}
|
|
1581
1602
|
function createContractRow(name, rawSchema, required, options = {}) {
|
|
1582
1603
|
const schema = resolveSchema(rawSchema) ?? {};
|
|
1583
|
-
const nestedSchema = schema
|
|
1604
|
+
const nestedSchema = schemaComposition(schema)
|
|
1584
1605
|
? rawSchema
|
|
1585
|
-
: schema.type === '
|
|
1586
|
-
?
|
|
1587
|
-
:
|
|
1606
|
+
: schema.type === 'object' && schema.properties
|
|
1607
|
+
? rawSchema
|
|
1608
|
+
: schema.type === 'array' && resolveSchema(schema.items)?.properties
|
|
1609
|
+
? schema.items
|
|
1610
|
+
: null;
|
|
1588
1611
|
const row = doc.createElement('div');
|
|
1589
1612
|
row.className = `schema-tree-row${nestedSchema ? ' schema-tree-row-expandable' : ''}`;
|
|
1590
1613
|
const key = doc.createElement('div');
|
|
@@ -2072,6 +2095,24 @@ function renderSchemaTree(parent, schema, depth = 0, refStack = new Set()) {
|
|
|
2072
2095
|
row.textContent = `Unresolved schema reference: ${refName}`;
|
|
2073
2096
|
div.appendChild(row);
|
|
2074
2097
|
}
|
|
2098
|
+
else if (schemaComposition(schema)) {
|
|
2099
|
+
const composition = schemaComposition(schema);
|
|
2100
|
+
const header = doc.createElement('div');
|
|
2101
|
+
header.className = 'schema-tree-row schema-tree-meta schema-composition-header';
|
|
2102
|
+
header.textContent = `${composition.label} ${composition.variants.length} variants`;
|
|
2103
|
+
div.appendChild(header);
|
|
2104
|
+
composition.variants.forEach((variant, index) => {
|
|
2105
|
+
const resolvedVariant = resolveSchema(variant);
|
|
2106
|
+
const group = doc.createElement('div');
|
|
2107
|
+
group.className = 'schema-composition-variant';
|
|
2108
|
+
const label = doc.createElement('div');
|
|
2109
|
+
label.className = 'schema-composition-label';
|
|
2110
|
+
label.textContent = resolvedVariant?.title || `Variant ${index + 1}`;
|
|
2111
|
+
group.appendChild(label);
|
|
2112
|
+
renderSchemaTree(group, variant, depth + 1, nextRefStack);
|
|
2113
|
+
div.appendChild(group);
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2075
2116
|
else if (schema.type === 'object' && schema.properties) {
|
|
2076
2117
|
Object.entries(schema.properties).forEach(([key, prop]) => {
|
|
2077
2118
|
const contract = createContractRow(key, prop, schema.required?.includes(key) === true);
|
|
@@ -1545,8 +1545,29 @@ function collectContractExamples(owner, schema) {
|
|
|
1545
1545
|
return true;
|
|
1546
1546
|
});
|
|
1547
1547
|
}
|
|
1548
|
+
function schemaComposition(schema) {
|
|
1549
|
+
if (!schema || typeof schema !== 'object')
|
|
1550
|
+
return null;
|
|
1551
|
+
if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
|
|
1552
|
+
return { label: 'One of', variants: schema.oneOf };
|
|
1553
|
+
}
|
|
1554
|
+
if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
|
|
1555
|
+
return { label: 'Any of', variants: schema.anyOf };
|
|
1556
|
+
}
|
|
1557
|
+
if (Array.isArray(schema.allOf) && schema.allOf.length > 0) {
|
|
1558
|
+
return { label: 'All of', variants: schema.allOf };
|
|
1559
|
+
}
|
|
1560
|
+
return null;
|
|
1561
|
+
}
|
|
1548
1562
|
function contractSchemaType(rawSchema, schema) {
|
|
1549
1563
|
const refName = rawSchema?.$ref ? String(rawSchema.$ref).split('/').pop() : '';
|
|
1564
|
+
const composition = schemaComposition(schema);
|
|
1565
|
+
if (composition) {
|
|
1566
|
+
return {
|
|
1567
|
+
type: 'composition',
|
|
1568
|
+
label: `${composition.label.toLowerCase()} ${composition.variants.length} variants`,
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1550
1571
|
const type = Array.isArray(schema?.type)
|
|
1551
1572
|
? schema.type.join(' | ')
|
|
1552
1573
|
: schema?.type || (refName ? 'object' : 'any');
|
|
@@ -1580,11 +1601,13 @@ function appendContractExamples(parent, examples, prefix = '') {
|
|
|
1580
1601
|
}
|
|
1581
1602
|
function createContractRow(name, rawSchema, required, options = {}) {
|
|
1582
1603
|
const schema = resolveSchema(rawSchema) ?? {};
|
|
1583
|
-
const nestedSchema = schema
|
|
1604
|
+
const nestedSchema = schemaComposition(schema)
|
|
1584
1605
|
? rawSchema
|
|
1585
|
-
: schema.type === '
|
|
1586
|
-
?
|
|
1587
|
-
:
|
|
1606
|
+
: schema.type === 'object' && schema.properties
|
|
1607
|
+
? rawSchema
|
|
1608
|
+
: schema.type === 'array' && resolveSchema(schema.items)?.properties
|
|
1609
|
+
? schema.items
|
|
1610
|
+
: null;
|
|
1588
1611
|
const row = doc.createElement('div');
|
|
1589
1612
|
row.className = `schema-tree-row${nestedSchema ? ' schema-tree-row-expandable' : ''}`;
|
|
1590
1613
|
const key = doc.createElement('div');
|
|
@@ -2072,6 +2095,24 @@ function renderSchemaTree(parent, schema, depth = 0, refStack = new Set()) {
|
|
|
2072
2095
|
row.textContent = `Unresolved schema reference: ${refName}`;
|
|
2073
2096
|
div.appendChild(row);
|
|
2074
2097
|
}
|
|
2098
|
+
else if (schemaComposition(schema)) {
|
|
2099
|
+
const composition = schemaComposition(schema);
|
|
2100
|
+
const header = doc.createElement('div');
|
|
2101
|
+
header.className = 'schema-tree-row schema-tree-meta schema-composition-header';
|
|
2102
|
+
header.textContent = `${composition.label} ${composition.variants.length} variants`;
|
|
2103
|
+
div.appendChild(header);
|
|
2104
|
+
composition.variants.forEach((variant, index) => {
|
|
2105
|
+
const resolvedVariant = resolveSchema(variant);
|
|
2106
|
+
const group = doc.createElement('div');
|
|
2107
|
+
group.className = 'schema-composition-variant';
|
|
2108
|
+
const label = doc.createElement('div');
|
|
2109
|
+
label.className = 'schema-composition-label';
|
|
2110
|
+
label.textContent = resolvedVariant?.title || `Variant ${index + 1}`;
|
|
2111
|
+
group.appendChild(label);
|
|
2112
|
+
renderSchemaTree(group, variant, depth + 1, nextRefStack);
|
|
2113
|
+
div.appendChild(group);
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2075
2116
|
else if (schema.type === 'object' && schema.properties) {
|
|
2076
2117
|
Object.entries(schema.properties).forEach(([key, prop]) => {
|
|
2077
2118
|
const contract = createContractRow(key, prop, schema.required?.includes(key) === true);
|