@ultrst-armada/kloks 1.10.4 → 1.12.0
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.12.0",
|
|
5
|
+
"sourceCommit": "3b4fb17e13cd3afc36e9233d4cec9132d42f4633",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40325400585"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -554,7 +554,8 @@ interface ComponentDescriptor {
|
|
|
554
554
|
}
|
|
555
555
|
interface SectionDescriptor {
|
|
556
556
|
name: string;
|
|
557
|
-
|
|
557
|
+
/** Optional for structural authoring sections that are not reusable components. */
|
|
558
|
+
assetRef?: AssetRef;
|
|
558
559
|
components: ComponentDescriptor[];
|
|
559
560
|
description?: string;
|
|
560
561
|
}
|
|
@@ -602,6 +603,11 @@ interface MonacoIdeSession {
|
|
|
602
603
|
sessionId: string;
|
|
603
604
|
document: MonacoDocument;
|
|
604
605
|
options: MonacoEditorOptions;
|
|
606
|
+
workspaceContext?: MonacoWorkspaceContext;
|
|
607
|
+
languageConfiguration?: MonacoLanguageConfiguration;
|
|
608
|
+
completions?: MonacoCompletionItem[];
|
|
609
|
+
validation?: MonacoValidationResult;
|
|
610
|
+
importAnalysis?: MonacoImportAnalysis[];
|
|
605
611
|
createdAt: number;
|
|
606
612
|
updatedAt: number;
|
|
607
613
|
}
|
|
@@ -617,6 +623,75 @@ interface MonacoUpdateDocumentInput {
|
|
|
617
623
|
value: string;
|
|
618
624
|
language?: string;
|
|
619
625
|
}
|
|
626
|
+
interface MonacoCompletionItem {
|
|
627
|
+
label: string;
|
|
628
|
+
insertText?: string;
|
|
629
|
+
detail?: string;
|
|
630
|
+
documentation?: string;
|
|
631
|
+
kind?: string;
|
|
632
|
+
sortText?: string;
|
|
633
|
+
}
|
|
634
|
+
interface MonacoCompletionRequest {
|
|
635
|
+
sessionId: string;
|
|
636
|
+
uri: string;
|
|
637
|
+
language: string;
|
|
638
|
+
value: string;
|
|
639
|
+
position: {
|
|
640
|
+
lineNumber: number;
|
|
641
|
+
column: number;
|
|
642
|
+
offset: number;
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
interface MonacoWorkspaceContext {
|
|
646
|
+
workspaceId: string;
|
|
647
|
+
rootUri: string;
|
|
648
|
+
files: Array<{
|
|
649
|
+
uri: string;
|
|
650
|
+
language?: string;
|
|
651
|
+
}>;
|
|
652
|
+
dependencies?: Record<string, string>;
|
|
653
|
+
metadata?: Record<string, string>;
|
|
654
|
+
}
|
|
655
|
+
interface MonacoImportAnalysis {
|
|
656
|
+
specifier: string;
|
|
657
|
+
importedSymbols: string[];
|
|
658
|
+
lineNumber: number;
|
|
659
|
+
resolvedUri?: string;
|
|
660
|
+
resolved: boolean;
|
|
661
|
+
}
|
|
662
|
+
interface MonacoValidationResult {
|
|
663
|
+
valid: boolean;
|
|
664
|
+
diagnostics: MonacoDiagnostic[];
|
|
665
|
+
checkedAt: number;
|
|
666
|
+
}
|
|
667
|
+
type MonacoCompletionProvider = (request: MonacoCompletionRequest) => Promise<MonacoCompletionItem[]>;
|
|
668
|
+
interface MonacoLanguageConfiguration {
|
|
669
|
+
language: string;
|
|
670
|
+
extensions?: string[];
|
|
671
|
+
aliases?: string[];
|
|
672
|
+
configuration: Record<string, unknown>;
|
|
673
|
+
}
|
|
674
|
+
interface MonacoSerializedSession {
|
|
675
|
+
schemaVersion: '1.0.0';
|
|
676
|
+
serializedAt: number;
|
|
677
|
+
session: MonacoIdeSession;
|
|
678
|
+
}
|
|
679
|
+
interface MonacoSetWorkspaceContextInput {
|
|
680
|
+
sessionId: string;
|
|
681
|
+
workspaceContext: MonacoWorkspaceContext;
|
|
682
|
+
}
|
|
683
|
+
interface MonacoSetCompletionsInput {
|
|
684
|
+
sessionId: string;
|
|
685
|
+
completions: MonacoCompletionItem[];
|
|
686
|
+
}
|
|
687
|
+
interface MonacoSetValidationResultInput {
|
|
688
|
+
sessionId: string;
|
|
689
|
+
validation: MonacoValidationResult;
|
|
690
|
+
}
|
|
691
|
+
interface MonacoSetImportAnalysisInput {
|
|
692
|
+
sessionId: string;
|
|
693
|
+
imports: MonacoImportAnalysis[];
|
|
694
|
+
}
|
|
620
695
|
|
|
621
696
|
type UIAuthoringContext = 'service' | 'general-component' | 'application';
|
|
622
697
|
type UIAuthoringNodeKind = 'page' | 'section' | 'component';
|
|
@@ -720,4 +795,4 @@ declare const KLOKS_CANONICAL_CONTRACT: {
|
|
|
720
795
|
validateCompatibility: (consumerSymbols?: string[]) => CompatibilityCheckResult;
|
|
721
796
|
};
|
|
722
797
|
|
|
723
|
-
export { type AssetRef, type AudioBusConfig, AudioBusConfigSchema, type AudioHardwareState, AudioHardwareStateSchema, type BackendOperation, BackendOperationSchema, type CompatibilityCheckResult, type ComponentDescriptor, type ContractDiffResult, type ContractSnapshot, ContractSnapshotSchema, type ExportSymbolEntry, type GraphEntityMetadata, GraphEntityMetadataSchema, KLOKS_CANONICAL_CONTRACT, KLOKS_PUBLIC_SURFACE, type MidiCommandType, MidiCommandTypeSchema, type MidiEventPayload, MidiEventPayloadSchema, type MonacoCreateSessionInput, type MonacoDiagnostic, type MonacoDiagnosticSeverity, type MonacoDocument, type MonacoEditorOptions, type MonacoIdeSession, type MonacoUpdateDocumentInput, type NodeDimensions2D, NodeDimensions2DSchema, type NodeHeaderStyle, NodeHeaderStyleSchema, type NodeScreenRect2D, NodeScreenRect2DSchema, type OperationBinding, type PageDescriptor, type PublicContractDefinition, PublicContractDefinitionSchema, QWNSR_REQUIRED_SURFACE, type SectionDescriptor, type ServiceUISchema, type SocketDirection, SocketDirectionSchema, type SocketGeometryConfig, SocketGeometryConfigSchema, type SocketPosition2D, SocketPosition2DSchema, type SocketStyleConfig, SocketStyleConfigSchema, type UIAuthoringBinding, type UIAuthoringContext, type UIAuthoringCreateInput, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringOperation, type UIAuthoringSession, type UIAuthoringValidation, type UIComponentArtifact, type UIComponentPromotion, type UIComponentPurpose, type UIRequirementMode, UI_AUTHORING_SCHEMA_VERSION, type WireAnimationConfig, WireAnimationConfigSchema, type WireCurveStyle, WireCurveStyleSchema, type WireEndpoint2D, WireEndpoint2DSchema, type WireVisualConfig, WireVisualConfigSchema, buildServiceUISchema, buildUIComponentArtifact, createKloksSnapshot, diffContractSnapshots, getUIComponentPromotion, getUIComponentPurpose, suggestUIComponent, validateConsumerSurfaceCompatibility };
|
|
798
|
+
export { type AssetRef, type AudioBusConfig, AudioBusConfigSchema, type AudioHardwareState, AudioHardwareStateSchema, type BackendOperation, BackendOperationSchema, type CompatibilityCheckResult, type ComponentDescriptor, type ContractDiffResult, type ContractSnapshot, ContractSnapshotSchema, type ExportSymbolEntry, type GraphEntityMetadata, GraphEntityMetadataSchema, KLOKS_CANONICAL_CONTRACT, KLOKS_PUBLIC_SURFACE, type MidiCommandType, MidiCommandTypeSchema, type MidiEventPayload, MidiEventPayloadSchema, type MonacoCompletionItem, type MonacoCompletionProvider, type MonacoCompletionRequest, type MonacoCreateSessionInput, type MonacoDiagnostic, type MonacoDiagnosticSeverity, type MonacoDocument, type MonacoEditorOptions, type MonacoIdeSession, type MonacoImportAnalysis, type MonacoLanguageConfiguration, type MonacoSerializedSession, type MonacoSetCompletionsInput, type MonacoSetImportAnalysisInput, type MonacoSetValidationResultInput, type MonacoSetWorkspaceContextInput, type MonacoUpdateDocumentInput, type MonacoValidationResult, type MonacoWorkspaceContext, type NodeDimensions2D, NodeDimensions2DSchema, type NodeHeaderStyle, NodeHeaderStyleSchema, type NodeScreenRect2D, NodeScreenRect2DSchema, type OperationBinding, type PageDescriptor, type PublicContractDefinition, PublicContractDefinitionSchema, QWNSR_REQUIRED_SURFACE, type SectionDescriptor, type ServiceUISchema, type SocketDirection, SocketDirectionSchema, type SocketGeometryConfig, SocketGeometryConfigSchema, type SocketPosition2D, SocketPosition2DSchema, type SocketStyleConfig, SocketStyleConfigSchema, type UIAuthoringBinding, type UIAuthoringContext, type UIAuthoringCreateInput, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringOperation, type UIAuthoringSession, type UIAuthoringValidation, type UIComponentArtifact, type UIComponentPromotion, type UIComponentPurpose, type UIRequirementMode, UI_AUTHORING_SCHEMA_VERSION, type WireAnimationConfig, WireAnimationConfigSchema, type WireCurveStyle, WireCurveStyleSchema, type WireEndpoint2D, WireEndpoint2DSchema, type WireVisualConfig, WireVisualConfigSchema, buildServiceUISchema, buildUIComponentArtifact, createKloksSnapshot, diffContractSnapshots, getUIComponentPromotion, getUIComponentPurpose, suggestUIComponent, validateConsumerSurfaceCompatibility };
|
|
@@ -397,7 +397,24 @@ function buildServiceUISchema(session) {
|
|
|
397
397
|
const pages = session.nodes.filter((node) => node.kind === "page");
|
|
398
398
|
const sections = session.nodes.filter((node) => node.kind === "section");
|
|
399
399
|
const components = session.nodes.filter((node) => node.kind === "component");
|
|
400
|
-
const assetRefs =
|
|
400
|
+
const assetRefs = [
|
|
401
|
+
...sections.map((node) => node.assetRef),
|
|
402
|
+
...components.map((node) => node.assetRef)
|
|
403
|
+
].filter(Boolean);
|
|
404
|
+
const componentDescriptor = (component) => {
|
|
405
|
+
if (!component.assetRef) throw new Error(`Component '${component.id}' requires a FLOKS asset reference before ServiceUISchema generation.`);
|
|
406
|
+
return {
|
|
407
|
+
name: component.name,
|
|
408
|
+
assetRef: component.assetRef,
|
|
409
|
+
description: component.props.description
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
const sectionDescriptor = (section) => ({
|
|
413
|
+
name: section.name,
|
|
414
|
+
...section.assetRef ? { assetRef: section.assetRef } : {},
|
|
415
|
+
components: components.filter((component) => component.parentId === section.id).map(componentDescriptor),
|
|
416
|
+
description: section.props.description
|
|
417
|
+
});
|
|
401
418
|
return {
|
|
402
419
|
schemaId: `kloks.authored-ui.${session.sessionId}`,
|
|
403
420
|
schemaVersion: UI_AUTHORING_SCHEMA_VERSION,
|
|
@@ -405,32 +422,11 @@ function buildServiceUISchema(session) {
|
|
|
405
422
|
requirementMode: "optional",
|
|
406
423
|
pages: pages.map((page) => ({
|
|
407
424
|
name: page.name,
|
|
408
|
-
sections: sections.filter((section) => section.parentId === page.id).map(
|
|
409
|
-
name: section.name,
|
|
410
|
-
assetRef: section.assetRef,
|
|
411
|
-
components: components.filter((component) => component.parentId === section.id).map((component) => ({
|
|
412
|
-
name: component.name,
|
|
413
|
-
assetRef: component.assetRef,
|
|
414
|
-
description: component.props.description
|
|
415
|
-
})),
|
|
416
|
-
description: section.props.description
|
|
417
|
-
})),
|
|
425
|
+
sections: sections.filter((section) => section.parentId === page.id).map(sectionDescriptor),
|
|
418
426
|
description: page.props.description
|
|
419
427
|
})),
|
|
420
|
-
sections: sections.map(
|
|
421
|
-
|
|
422
|
-
assetRef: section.assetRef,
|
|
423
|
-
components: components.filter((component) => component.parentId === section.id).map((component) => ({
|
|
424
|
-
name: component.name,
|
|
425
|
-
assetRef: component.assetRef
|
|
426
|
-
})),
|
|
427
|
-
description: section.props.description
|
|
428
|
-
})),
|
|
429
|
-
components: components.map((component) => ({
|
|
430
|
-
name: component.name,
|
|
431
|
-
assetRef: component.assetRef,
|
|
432
|
-
description: component.props.description
|
|
433
|
-
})),
|
|
428
|
+
sections: sections.map(sectionDescriptor),
|
|
429
|
+
components: components.map(componentDescriptor),
|
|
434
430
|
assetRefs,
|
|
435
431
|
operationBindings: session.bindings.map((binding) => ({
|
|
436
432
|
operationId: binding.target.apiId,
|
|
@@ -3,7 +3,7 @@ import { ServiceDefinition, IService, EndpointDescriptor, ProtocolAdapter } from
|
|
|
3
3
|
import { AdminDatabaseClusterConfig, DatabaseConnectionEntry, UserStorageConnection, AuthState, UserAccount, UserRole, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
|
|
4
4
|
export { AuthState, UserAccount, UserRole, UserSession, UserStorageConnection, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
|
|
5
5
|
import * as _kloks_contracts from '@ultrst-armada/kloks/contracts';
|
|
6
|
-
import { ServiceUISchema, MonacoIdeSession, UIAuthoringSession } from '@ultrst-armada/kloks/contracts';
|
|
6
|
+
import { ServiceUISchema, MonacoIdeSession, MonacoLanguageConfiguration, UIAuthoringSession } from '@ultrst-armada/kloks/contracts';
|
|
7
7
|
|
|
8
8
|
interface SystemEnvironmentStatus {
|
|
9
9
|
databaseUrlConfigured: boolean;
|
|
@@ -278,8 +278,10 @@ declare const SystemDbServiceUISchema: ServiceUISchema;
|
|
|
278
278
|
|
|
279
279
|
interface MonacoState extends Record<string, unknown> {
|
|
280
280
|
sessions: Record<string, MonacoIdeSession>;
|
|
281
|
+
workspaces: Record<string, _kloks_contracts.MonacoWorkspaceContext>;
|
|
282
|
+
languageConfigurations: Record<string, MonacoLanguageConfiguration>;
|
|
281
283
|
}
|
|
282
|
-
declare const MonacoIdeServiceDefinition: ServiceDefinition<MonacoState
|
|
284
|
+
declare const MonacoIdeServiceDefinition: ServiceDefinition<MonacoState, Record<string, unknown>>;
|
|
283
285
|
declare function createMonacoIdeService(): IService<MonacoState>;
|
|
284
286
|
declare const MonacoIdeServiceFacade: {
|
|
285
287
|
id: string;
|
|
@@ -288,7 +290,7 @@ declare const MonacoIdeServiceFacade: {
|
|
|
288
290
|
runtime: "client";
|
|
289
291
|
deployment: "local";
|
|
290
292
|
definition: ServiceDefinition<MonacoState, Record<string, unknown>>;
|
|
291
|
-
service:
|
|
293
|
+
service: _ultrst_armada_krnl.ServiceInstance<MonacoState, Record<string, unknown>>;
|
|
292
294
|
createInstance: typeof createMonacoIdeService;
|
|
293
295
|
execute: <TIn = unknown, TOut = unknown>(operation: string, input?: TIn) => Promise<TOut>;
|
|
294
296
|
};
|
|
@@ -296,7 +298,7 @@ declare const MonacoIdeServiceFacade: {
|
|
|
296
298
|
interface UIAuthoringState extends Record<string, unknown> {
|
|
297
299
|
sessions: Record<string, UIAuthoringSession>;
|
|
298
300
|
}
|
|
299
|
-
declare const UIAuthoringServiceDefinition: ServiceDefinition<UIAuthoringState
|
|
301
|
+
declare const UIAuthoringServiceDefinition: ServiceDefinition<UIAuthoringState, Record<string, unknown>>;
|
|
300
302
|
declare function createUIAuthoringService(): IService<UIAuthoringState>;
|
|
301
303
|
declare const UIAuthoringServiceFacade: {
|
|
302
304
|
id: string;
|
|
@@ -305,7 +307,7 @@ declare const UIAuthoringServiceFacade: {
|
|
|
305
307
|
runtime: "client";
|
|
306
308
|
deployment: "local";
|
|
307
309
|
definition: ServiceDefinition<UIAuthoringState, Record<string, unknown>>;
|
|
308
|
-
service:
|
|
310
|
+
service: _ultrst_armada_krnl.ServiceInstance<UIAuthoringState, Record<string, unknown>>;
|
|
309
311
|
createInstance: typeof createUIAuthoringService;
|
|
310
312
|
execute: <TIn = unknown, TOut = unknown>(operation: string, input?: TIn) => Promise<TOut>;
|
|
311
313
|
};
|
|
@@ -1653,94 +1653,226 @@ var storageService = new StorageService();
|
|
|
1653
1653
|
|
|
1654
1654
|
// src/client-services/monacoIdeService.ts
|
|
1655
1655
|
var activeMonacoService;
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1656
|
+
function buildMonacoIdeServiceDefinition(getService) {
|
|
1657
|
+
return createServiceDefinition({
|
|
1658
|
+
id: "kloks.service.monacoIde",
|
|
1659
|
+
name: "MonacoIdeService",
|
|
1660
|
+
version: "1.0.0",
|
|
1661
|
+
state: { initial: { sessions: {}, workspaces: {}, languageConfigurations: {} } },
|
|
1662
|
+
operations: {
|
|
1663
|
+
createSession: {
|
|
1664
|
+
id: "MonacoIdeService.createSession",
|
|
1665
|
+
name: "createSession",
|
|
1666
|
+
handler: async (input, ctx) => {
|
|
1667
|
+
const sessionId = input.sessionId || `monaco-${Date.now().toString(36)}`;
|
|
1668
|
+
const now = Date.now();
|
|
1669
|
+
const session = {
|
|
1670
|
+
sessionId,
|
|
1671
|
+
document: { uri: input.uri, language: input.language, value: input.value, version: 1, diagnostics: [] },
|
|
1672
|
+
options: input.options || {},
|
|
1673
|
+
createdAt: now,
|
|
1674
|
+
updatedAt: now
|
|
1675
|
+
};
|
|
1676
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [sessionId]: session } });
|
|
1677
|
+
return session;
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
updateDocument: {
|
|
1681
|
+
id: "MonacoIdeService.updateDocument",
|
|
1682
|
+
name: "updateDocument",
|
|
1683
|
+
handler: async (input, ctx) => {
|
|
1684
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1685
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1686
|
+
const document = {
|
|
1687
|
+
...current.document,
|
|
1688
|
+
value: input.value,
|
|
1689
|
+
language: input.language || current.document.language,
|
|
1690
|
+
version: current.document.version + 1
|
|
1691
|
+
};
|
|
1692
|
+
const session = { ...current, document, updatedAt: Date.now() };
|
|
1693
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
|
|
1694
|
+
return session;
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
setDiagnostics: {
|
|
1698
|
+
id: "MonacoIdeService.setDiagnostics",
|
|
1699
|
+
name: "setDiagnostics",
|
|
1700
|
+
handler: async (input, ctx) => {
|
|
1701
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1702
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1703
|
+
const session = {
|
|
1704
|
+
...current,
|
|
1705
|
+
document: { ...current.document, diagnostics: input.diagnostics },
|
|
1706
|
+
updatedAt: Date.now()
|
|
1707
|
+
};
|
|
1708
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
|
|
1709
|
+
return session;
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1712
|
+
setOptions: {
|
|
1713
|
+
id: "MonacoIdeService.setOptions",
|
|
1714
|
+
name: "setOptions",
|
|
1715
|
+
handler: async (input, ctx) => {
|
|
1716
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1717
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1718
|
+
const session = { ...current, options: { ...current.options, ...input.options }, updatedAt: Date.now() };
|
|
1719
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
|
|
1720
|
+
return session;
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
getSession: {
|
|
1724
|
+
id: "MonacoIdeService.getSession",
|
|
1725
|
+
name: "getSession",
|
|
1726
|
+
handler: async (input, ctx) => getService().getState().sessions[input.sessionId] || null
|
|
1727
|
+
},
|
|
1728
|
+
disposeSession: {
|
|
1729
|
+
id: "MonacoIdeService.disposeSession",
|
|
1730
|
+
name: "disposeSession",
|
|
1731
|
+
handler: async (input, ctx) => {
|
|
1732
|
+
const sessions = { ...getService().getState().sessions };
|
|
1733
|
+
delete sessions[input.sessionId];
|
|
1734
|
+
getService().setState({ ...getService().getState(), sessions });
|
|
1735
|
+
return { disposed: true, sessionId: input.sessionId };
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1738
|
+
setWorkspaceContext: {
|
|
1739
|
+
id: "MonacoIdeService.setWorkspaceContext",
|
|
1740
|
+
name: "setWorkspaceContext",
|
|
1741
|
+
handler: async (input, ctx) => {
|
|
1742
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1743
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1744
|
+
const session = { ...current, workspaceContext: input.workspaceContext, updatedAt: Date.now() };
|
|
1745
|
+
const state = getService().getState();
|
|
1746
|
+
getService().setState({
|
|
1747
|
+
...state,
|
|
1748
|
+
sessions: { ...state.sessions, [input.sessionId]: session },
|
|
1749
|
+
workspaces: { ...state.workspaces, [input.workspaceContext.workspaceId]: input.workspaceContext }
|
|
1750
|
+
});
|
|
1751
|
+
return session;
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
setLanguageConfiguration: {
|
|
1755
|
+
id: "MonacoIdeService.setLanguageConfiguration",
|
|
1756
|
+
name: "setLanguageConfiguration",
|
|
1757
|
+
handler: async (input, ctx) => {
|
|
1758
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1759
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1760
|
+
const state = getService().getState();
|
|
1761
|
+
const session = { ...current, languageConfiguration: input.configuration, updatedAt: Date.now() };
|
|
1762
|
+
getService().setState({
|
|
1763
|
+
...state,
|
|
1764
|
+
sessions: { ...state.sessions, [input.sessionId]: session },
|
|
1765
|
+
languageConfigurations: { ...state.languageConfigurations, [input.configuration.language]: input.configuration }
|
|
1766
|
+
});
|
|
1767
|
+
return session;
|
|
1768
|
+
}
|
|
1769
|
+
},
|
|
1770
|
+
setCompletions: {
|
|
1771
|
+
id: "MonacoIdeService.setCompletions",
|
|
1772
|
+
name: "setCompletions",
|
|
1773
|
+
handler: async (input, ctx) => {
|
|
1774
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1775
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1776
|
+
const session = { ...current, completions: input.completions, updatedAt: Date.now() };
|
|
1777
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
|
|
1778
|
+
return session;
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
setValidationResult: {
|
|
1782
|
+
id: "MonacoIdeService.setValidationResult",
|
|
1783
|
+
name: "setValidationResult",
|
|
1784
|
+
handler: async (input, ctx) => {
|
|
1785
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1786
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1787
|
+
const session = {
|
|
1788
|
+
...current,
|
|
1789
|
+
validation: input.validation,
|
|
1790
|
+
document: { ...current.document, diagnostics: input.validation.diagnostics },
|
|
1791
|
+
updatedAt: Date.now()
|
|
1792
|
+
};
|
|
1793
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
|
|
1794
|
+
return session;
|
|
1795
|
+
}
|
|
1796
|
+
},
|
|
1797
|
+
setImportAnalysis: {
|
|
1798
|
+
id: "MonacoIdeService.setImportAnalysis",
|
|
1799
|
+
name: "setImportAnalysis",
|
|
1800
|
+
handler: async (input, ctx) => {
|
|
1801
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1802
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1803
|
+
const session = { ...current, importAnalysis: input.imports, updatedAt: Date.now() };
|
|
1804
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
|
|
1805
|
+
return session;
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
analyzeImports: {
|
|
1809
|
+
id: "MonacoIdeService.analyzeImports",
|
|
1810
|
+
name: "analyzeImports",
|
|
1811
|
+
handler: async (input, ctx) => {
|
|
1812
|
+
const current = getService().getState().sessions[input.sessionId];
|
|
1813
|
+
if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1814
|
+
const workspace = current.workspaceContext;
|
|
1815
|
+
const source = current.document.value;
|
|
1816
|
+
const pattern = /\bimport\s+(?:[^'"]*?\s+from\s*)?['"]([^'"]+)['"]|\bexport\s+[^'"]*?\s+from\s*['"]([^'"]+)['"]|\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
1817
|
+
const imports = [];
|
|
1818
|
+
for (const match of source.matchAll(pattern)) {
|
|
1819
|
+
const specifier = match[1] || match[2] || match[3];
|
|
1820
|
+
if (!specifier) continue;
|
|
1821
|
+
const lineNumber = source.slice(0, match.index || 0).split("\n").length;
|
|
1822
|
+
const normalizedSpecifier = specifier.replace(/^\.\//, "");
|
|
1823
|
+
const resolvedUri = workspace?.files.find(
|
|
1824
|
+
(file) => file.uri === specifier || file.uri.endsWith("/" + normalizedSpecifier) || file.uri.endsWith(normalizedSpecifier)
|
|
1825
|
+
)?.uri;
|
|
1826
|
+
imports.push({
|
|
1827
|
+
specifier,
|
|
1828
|
+
importedSymbols: [],
|
|
1829
|
+
lineNumber,
|
|
1830
|
+
resolvedUri,
|
|
1831
|
+
resolved: Boolean(resolvedUri || workspace?.dependencies?.[specifier])
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
const session = { ...current, importAnalysis: imports, updatedAt: Date.now() };
|
|
1835
|
+
getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
|
|
1836
|
+
return imports;
|
|
1837
|
+
}
|
|
1838
|
+
},
|
|
1839
|
+
serializeSession: {
|
|
1840
|
+
id: "MonacoIdeService.serializeSession",
|
|
1841
|
+
name: "serializeSession",
|
|
1842
|
+
handler: async (input, ctx) => {
|
|
1843
|
+
const session = getService().getState().sessions[input.sessionId];
|
|
1844
|
+
if (!session) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
|
|
1845
|
+
return { schemaVersion: "1.0.0", serializedAt: Date.now(), session: structuredClone(session) };
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
restoreSession: {
|
|
1849
|
+
id: "MonacoIdeService.restoreSession",
|
|
1850
|
+
name: "restoreSession",
|
|
1851
|
+
handler: async (input, ctx) => {
|
|
1852
|
+
if (input.serialized.schemaVersion !== "1.0.0") throw new Error("Unsupported Monaco session schema version.");
|
|
1853
|
+
const session = input.serialized.session;
|
|
1854
|
+
if (!session?.sessionId || !session.document?.uri) throw new Error("Invalid serialized Monaco session.");
|
|
1855
|
+
const state = getService().getState();
|
|
1856
|
+
getService().setState({ ...state, sessions: { ...state.sessions, [session.sessionId]: session } });
|
|
1857
|
+
return session;
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
getLanguageConfiguration: {
|
|
1861
|
+
id: "MonacoIdeService.getLanguageConfiguration",
|
|
1862
|
+
name: "getLanguageConfiguration",
|
|
1863
|
+
handler: async (input, ctx) => getService().getState().languageConfigurations[input.language] || null
|
|
1735
1864
|
}
|
|
1736
1865
|
}
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
var MonacoIdeServiceDefinition = buildMonacoIdeServiceDefinition(() => activeMonacoService);
|
|
1739
1869
|
function createMonacoIdeService() {
|
|
1740
|
-
|
|
1741
|
-
|
|
1870
|
+
let instance;
|
|
1871
|
+
instance = createService(buildMonacoIdeServiceDefinition(() => instance));
|
|
1872
|
+
return instance;
|
|
1742
1873
|
}
|
|
1743
|
-
var defaultMonacoIdeService =
|
|
1874
|
+
var defaultMonacoIdeService = createService(MonacoIdeServiceDefinition);
|
|
1875
|
+
activeMonacoService = defaultMonacoIdeService;
|
|
1744
1876
|
var MonacoIdeServiceFacade = {
|
|
1745
1877
|
id: MonacoIdeServiceDefinition.id,
|
|
1746
1878
|
name: MonacoIdeServiceDefinition.name,
|
|
@@ -1759,106 +1891,136 @@ var MonacoIdeServiceFacade = {
|
|
|
1759
1891
|
// src/client-services/uiAuthoringService.ts
|
|
1760
1892
|
import { buildServiceUISchema, buildUIComponentArtifact, suggestUIComponent } from "@ultrst-armada/kloks/contracts";
|
|
1761
1893
|
var activeUIAuthoringService;
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1894
|
+
function buildUIAuthoringServiceDefinition(getService) {
|
|
1895
|
+
return createServiceDefinition({
|
|
1896
|
+
id: "kloks.service.uiAuthoring",
|
|
1897
|
+
name: "UIAuthoringService",
|
|
1898
|
+
version: "1.0.0",
|
|
1899
|
+
state: { initial: { sessions: {} } },
|
|
1900
|
+
operations: {
|
|
1901
|
+
createSession: {
|
|
1902
|
+
id: "UIAuthoringService.createSession",
|
|
1903
|
+
name: "createSession",
|
|
1904
|
+
handler: async (input, ctx) => {
|
|
1905
|
+
const sessionId = input.sessionId || `ui-authoring-${Date.now().toString(36)}`;
|
|
1906
|
+
const session = {
|
|
1907
|
+
sessionId,
|
|
1908
|
+
context: input.context,
|
|
1909
|
+
nodes: [],
|
|
1910
|
+
bindings: [],
|
|
1911
|
+
operations: input.operations || [],
|
|
1912
|
+
metadata: input.metadata || {}
|
|
1913
|
+
};
|
|
1914
|
+
getService().setState({ sessions: { ...getService().getState().sessions, [sessionId]: session } });
|
|
1915
|
+
return session;
|
|
1916
|
+
}
|
|
1917
|
+
},
|
|
1918
|
+
replaceSession: {
|
|
1919
|
+
id: "UIAuthoringService.replaceSession",
|
|
1920
|
+
name: "replaceSession",
|
|
1921
|
+
handler: async (input, ctx) => {
|
|
1922
|
+
if (input.sessionId !== input.session.sessionId) throw new Error("Session id mismatch.");
|
|
1923
|
+
return updateSession(getService(), input.sessionId, () => input.session);
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
addNode: {
|
|
1927
|
+
id: "UIAuthoringService.addNode",
|
|
1928
|
+
name: "addNode",
|
|
1929
|
+
handler: async (input, ctx) => updateSession(getService(), input.sessionId, (session) => ({
|
|
1930
|
+
...session,
|
|
1931
|
+
nodes: [...session.nodes.filter((node) => node.id !== input.node.id), input.node]
|
|
1932
|
+
}))
|
|
1933
|
+
},
|
|
1934
|
+
updateNode: {
|
|
1935
|
+
id: "UIAuthoringService.updateNode",
|
|
1936
|
+
name: "updateNode",
|
|
1937
|
+
handler: async (input, ctx) => updateSession(getService(), input.sessionId, (session) => ({
|
|
1938
|
+
...session,
|
|
1939
|
+
nodes: session.nodes.map((node) => node.id === input.nodeId ? { ...node, ...input.patch } : node)
|
|
1940
|
+
}))
|
|
1941
|
+
},
|
|
1942
|
+
removeNode: {
|
|
1943
|
+
id: "UIAuthoringService.removeNode",
|
|
1944
|
+
name: "removeNode",
|
|
1945
|
+
handler: async (input, ctx) => updateSession(getService(), input.sessionId, (session) => {
|
|
1946
|
+
const removedIds = /* @__PURE__ */ new Set([input.nodeId]);
|
|
1947
|
+
let expanded = true;
|
|
1948
|
+
while (expanded) {
|
|
1949
|
+
expanded = false;
|
|
1950
|
+
for (const node of session.nodes) {
|
|
1951
|
+
if (node.parentId && removedIds.has(node.parentId) && !removedIds.has(node.id)) {
|
|
1952
|
+
removedIds.add(node.id);
|
|
1953
|
+
expanded = true;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
return {
|
|
1958
|
+
...session,
|
|
1959
|
+
nodes: session.nodes.filter((node) => !removedIds.has(node.id)).map((node) => ({
|
|
1960
|
+
...node,
|
|
1961
|
+
slots: node.slots ? Object.fromEntries(Object.entries(node.slots).map(([slot, children]) => [
|
|
1962
|
+
slot,
|
|
1963
|
+
children.filter((childId) => !removedIds.has(childId))
|
|
1964
|
+
])) : void 0
|
|
1965
|
+
})),
|
|
1966
|
+
bindings: session.bindings.filter((binding) => !removedIds.has(binding.componentId))
|
|
1967
|
+
};
|
|
1968
|
+
})
|
|
1969
|
+
},
|
|
1970
|
+
setBinding: {
|
|
1971
|
+
id: "UIAuthoringService.setBinding",
|
|
1972
|
+
name: "setBinding",
|
|
1973
|
+
handler: async (input, ctx) => updateSession(getService(), input.sessionId, (session) => ({
|
|
1974
|
+
...session,
|
|
1975
|
+
bindings: [...session.bindings.filter((binding) => binding.componentId !== input.binding.componentId || binding.property !== input.binding.property), input.binding]
|
|
1976
|
+
}))
|
|
1977
|
+
},
|
|
1978
|
+
setOperations: {
|
|
1979
|
+
id: "UIAuthoringService.setOperations",
|
|
1980
|
+
name: "setOperations",
|
|
1981
|
+
handler: async (input, ctx) => updateSession(getService(), input.sessionId, (session) => ({ ...session, operations: input.operations }))
|
|
1982
|
+
},
|
|
1983
|
+
validate: {
|
|
1984
|
+
id: "UIAuthoringService.validate",
|
|
1985
|
+
name: "validate",
|
|
1986
|
+
handler: async (input, ctx) => validateSession(getSession(getService(), input.sessionId))
|
|
1987
|
+
},
|
|
1988
|
+
serialize: {
|
|
1989
|
+
id: "UIAuthoringService.serialize",
|
|
1990
|
+
name: "serialize",
|
|
1991
|
+
handler: async (input, ctx) => JSON.stringify(getSession(getService(), input.sessionId), null, 2)
|
|
1992
|
+
},
|
|
1993
|
+
generateArtifact: {
|
|
1994
|
+
id: "UIAuthoringService.generateArtifact",
|
|
1995
|
+
name: "generateArtifact",
|
|
1996
|
+
handler: async (input, ctx) => buildUIComponentArtifact(getSession(getService(), input.sessionId))
|
|
1997
|
+
},
|
|
1998
|
+
generateServiceUI: {
|
|
1999
|
+
id: "UIAuthoringService.generateServiceUI",
|
|
2000
|
+
name: "generateServiceUI",
|
|
2001
|
+
handler: async (input, ctx) => {
|
|
2002
|
+
const session = getSession(getService(), input.sessionId);
|
|
2003
|
+
const validation = validateSession(session);
|
|
2004
|
+
if (!validation.valid) {
|
|
2005
|
+
throw new Error(`Cannot generate ServiceUISchema: ${validation.errors.join("; ")}`);
|
|
2006
|
+
}
|
|
2007
|
+
return buildServiceUISchema(session);
|
|
2008
|
+
}
|
|
2009
|
+
},
|
|
2010
|
+
suggestComponent: {
|
|
2011
|
+
id: "UIAuthoringService.suggestComponent",
|
|
2012
|
+
name: "suggestComponent",
|
|
2013
|
+
handler: async (input) => suggestUIComponent(input.fieldType)
|
|
2014
|
+
},
|
|
2015
|
+
getSession: {
|
|
2016
|
+
id: "UIAuthoringService.getSession",
|
|
2017
|
+
name: "getSession",
|
|
2018
|
+
handler: async (input, ctx) => getService().getState().sessions[input.sessionId] || null
|
|
1791
2019
|
}
|
|
1792
|
-
},
|
|
1793
|
-
addNode: {
|
|
1794
|
-
id: "UIAuthoringService.addNode",
|
|
1795
|
-
name: "addNode",
|
|
1796
|
-
handler: async (input, ctx) => updateSession(activeUIAuthoringService, input.sessionId, (session) => ({
|
|
1797
|
-
...session,
|
|
1798
|
-
nodes: [...session.nodes.filter((node) => node.id !== input.node.id), input.node]
|
|
1799
|
-
}))
|
|
1800
|
-
},
|
|
1801
|
-
updateNode: {
|
|
1802
|
-
id: "UIAuthoringService.updateNode",
|
|
1803
|
-
name: "updateNode",
|
|
1804
|
-
handler: async (input, ctx) => updateSession(activeUIAuthoringService, input.sessionId, (session) => ({
|
|
1805
|
-
...session,
|
|
1806
|
-
nodes: session.nodes.map((node) => node.id === input.nodeId ? { ...node, ...input.patch } : node)
|
|
1807
|
-
}))
|
|
1808
|
-
},
|
|
1809
|
-
removeNode: {
|
|
1810
|
-
id: "UIAuthoringService.removeNode",
|
|
1811
|
-
name: "removeNode",
|
|
1812
|
-
handler: async (input, ctx) => updateSession(activeUIAuthoringService, input.sessionId, (session) => ({
|
|
1813
|
-
...session,
|
|
1814
|
-
nodes: session.nodes.filter((node) => node.id !== input.nodeId && node.parentId !== input.nodeId)
|
|
1815
|
-
}))
|
|
1816
|
-
},
|
|
1817
|
-
setBinding: {
|
|
1818
|
-
id: "UIAuthoringService.setBinding",
|
|
1819
|
-
name: "setBinding",
|
|
1820
|
-
handler: async (input, ctx) => updateSession(activeUIAuthoringService, input.sessionId, (session) => ({
|
|
1821
|
-
...session,
|
|
1822
|
-
bindings: [...session.bindings.filter((binding) => binding.componentId !== input.binding.componentId || binding.property !== input.binding.property), input.binding]
|
|
1823
|
-
}))
|
|
1824
|
-
},
|
|
1825
|
-
setOperations: {
|
|
1826
|
-
id: "UIAuthoringService.setOperations",
|
|
1827
|
-
name: "setOperations",
|
|
1828
|
-
handler: async (input, ctx) => updateSession(activeUIAuthoringService, input.sessionId, (session) => ({ ...session, operations: input.operations }))
|
|
1829
|
-
},
|
|
1830
|
-
validate: {
|
|
1831
|
-
id: "UIAuthoringService.validate",
|
|
1832
|
-
name: "validate",
|
|
1833
|
-
handler: async (input, ctx) => validateSession(getSession(activeUIAuthoringService, input.sessionId))
|
|
1834
|
-
},
|
|
1835
|
-
serialize: {
|
|
1836
|
-
id: "UIAuthoringService.serialize",
|
|
1837
|
-
name: "serialize",
|
|
1838
|
-
handler: async (input, ctx) => JSON.stringify(getSession(activeUIAuthoringService, input.sessionId), null, 2)
|
|
1839
|
-
},
|
|
1840
|
-
generateArtifact: {
|
|
1841
|
-
id: "UIAuthoringService.generateArtifact",
|
|
1842
|
-
name: "generateArtifact",
|
|
1843
|
-
handler: async (input, ctx) => buildUIComponentArtifact(getSession(activeUIAuthoringService, input.sessionId))
|
|
1844
|
-
},
|
|
1845
|
-
generateServiceUI: {
|
|
1846
|
-
id: "UIAuthoringService.generateServiceUI",
|
|
1847
|
-
name: "generateServiceUI",
|
|
1848
|
-
handler: async (input, ctx) => buildServiceUISchema(getSession(activeUIAuthoringService, input.sessionId))
|
|
1849
|
-
},
|
|
1850
|
-
suggestComponent: {
|
|
1851
|
-
id: "UIAuthoringService.suggestComponent",
|
|
1852
|
-
name: "suggestComponent",
|
|
1853
|
-
handler: async (input) => suggestUIComponent(input.fieldType)
|
|
1854
|
-
},
|
|
1855
|
-
getSession: {
|
|
1856
|
-
id: "UIAuthoringService.getSession",
|
|
1857
|
-
name: "getSession",
|
|
1858
|
-
handler: async (input, ctx) => activeUIAuthoringService.getState().sessions[input.sessionId] || null
|
|
1859
2020
|
}
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
var UIAuthoringServiceDefinition = buildUIAuthoringServiceDefinition(() => activeUIAuthoringService);
|
|
1862
2024
|
function getSession(service, sessionId) {
|
|
1863
2025
|
const session = service.getState().sessions[sessionId];
|
|
1864
2026
|
if (!session) throw new Error(`Unknown UI authoring session: ${sessionId}`);
|
|
@@ -1882,7 +2044,7 @@ function validateSession(session) {
|
|
|
1882
2044
|
if (node.kind === "section" && !node.parentId) errors.push(`Section requires a page parent: ${node.id}`);
|
|
1883
2045
|
if (node.kind === "section" && node.parentId && !session.nodes.some((parent) => parent.id === node.parentId && parent.kind === "page")) errors.push(`Section parent must be a page: ${node.id}`);
|
|
1884
2046
|
if (node.kind === "component" && !node.parentId) errors.push(`Component requires a section parent: ${node.id}`);
|
|
1885
|
-
if (node.kind === "component" && node.parentId && !session.nodes.some((parent) => parent.id === node.parentId && parent.kind === "section")) errors.push(`Component parent must be a section: ${node.id}`);
|
|
2047
|
+
if (node.kind === "component" && node.parentId && !session.nodes.some((parent) => parent.id === node.parentId && (parent.kind === "section" || parent.kind === "component"))) errors.push(`Component parent must be a section or component: ${node.id}`);
|
|
1886
2048
|
}
|
|
1887
2049
|
if (session.nodes.some((node) => node.kind === "component" && !node.assetRef)) errors.push("Every component node requires a FLOKS asset reference.");
|
|
1888
2050
|
if (session.context === "service" && !session.metadata.serviceId) errors.push("Service authoring requires metadata.serviceId.");
|
|
@@ -1922,10 +2084,12 @@ function validateSession(session) {
|
|
|
1922
2084
|
return { valid: errors.length === 0, errors, warnings };
|
|
1923
2085
|
}
|
|
1924
2086
|
function createUIAuthoringService() {
|
|
1925
|
-
|
|
1926
|
-
|
|
2087
|
+
let instance;
|
|
2088
|
+
instance = createService(buildUIAuthoringServiceDefinition(() => instance));
|
|
2089
|
+
return instance;
|
|
1927
2090
|
}
|
|
1928
|
-
var defaultUIAuthoringService =
|
|
2091
|
+
var defaultUIAuthoringService = createService(UIAuthoringServiceDefinition);
|
|
2092
|
+
activeUIAuthoringService = defaultUIAuthoringService;
|
|
1929
2093
|
var UIAuthoringServiceFacade = {
|
|
1930
2094
|
id: UIAuthoringServiceDefinition.id,
|
|
1931
2095
|
name: UIAuthoringServiceDefinition.name,
|