@kosdev-code/kos-ui-plugin 0.1.0-dev.5053
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/documentation-generator-DFaIDo0E.cjs +266 -0
- package/documentation-generator-DFaIDo0E.cjs.map +1 -0
- package/documentation-generator-auruIa_o.js +1560 -0
- package/documentation-generator-auruIa_o.js.map +1 -0
- package/index.cjs +437 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -0
- package/index.js +2276 -0
- package/index.js.map +1 -0
- package/lib/components/dynamic-component/dynamic-component.d.ts +11 -0
- package/lib/components/dynamic-component/dynamic-component.d.ts.map +1 -0
- package/lib/components/dynamic-component/error-boundary.d.ts +17 -0
- package/lib/components/dynamic-component/error-boundary.d.ts.map +1 -0
- package/lib/components/dynamic-component/index.d.ts +2 -0
- package/lib/components/dynamic-component/index.d.ts.map +1 -0
- package/lib/components/dynamic-container/dynamic-container.d.ts +12 -0
- package/lib/components/dynamic-container/dynamic-container.d.ts.map +1 -0
- package/lib/components/dynamic-container/index.d.ts +2 -0
- package/lib/components/dynamic-container/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/plugin-explorer/extension-point-list.d.ts +13 -0
- package/lib/components/plugin-explorer/extension-point-list.d.ts.map +1 -0
- package/lib/components/plugin-explorer/floating-plugin-explorer.d.ts +13 -0
- package/lib/components/plugin-explorer/floating-plugin-explorer.d.ts.map +1 -0
- package/lib/components/plugin-explorer/index.d.ts +10 -0
- package/lib/components/plugin-explorer/index.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-card.d.ts +10 -0
- package/lib/components/plugin-explorer/plugin-card.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-explorer.d.ts +12 -0
- package/lib/components/plugin-explorer/plugin-explorer.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-health-dashboard.d.ts +9 -0
- package/lib/components/plugin-explorer/plugin-health-dashboard.d.ts.map +1 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/contexts/index.d.ts.map +1 -0
- package/lib/contexts/plugins-provider/index.d.ts +2 -0
- package/lib/contexts/plugins-provider/index.d.ts.map +1 -0
- package/lib/contexts/plugins-provider/plugins-provider.d.ts +50 -0
- package/lib/contexts/plugins-provider/plugins-provider.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +6 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/use-dynamic-component.d.ts +34 -0
- package/lib/hooks/use-dynamic-component.d.ts.map +1 -0
- package/lib/hooks/use-extension-component.d.ts +26 -0
- package/lib/hooks/use-extension-component.d.ts.map +1 -0
- package/lib/hooks/use-extension-i18n.d.ts +69 -0
- package/lib/hooks/use-extension-i18n.d.ts.map +1 -0
- package/lib/hooks/use-plugin-discovery.d.ts +23 -0
- package/lib/hooks/use-plugin-discovery.d.ts.map +1 -0
- package/lib/hooks/use-typed-extensions.d.ts +152 -0
- package/lib/hooks/use-typed-extensions.d.ts.map +1 -0
- package/lib/utils/discovery/documentation-generator.d.ts +85 -0
- package/lib/utils/discovery/documentation-generator.d.ts.map +1 -0
- package/lib/utils/discovery/plugin-discovery-service.d.ts +109 -0
- package/lib/utils/discovery/plugin-discovery-service.d.ts.map +1 -0
- package/lib/utils/extension-points/define-extension-point.d.ts +58 -0
- package/lib/utils/extension-points/define-extension-point.d.ts.map +1 -0
- package/lib/utils/extension-points/example-extension-point.d.ts +67 -0
- package/lib/utils/extension-points/example-extension-point.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-registry.d.ts +59 -0
- package/lib/utils/extension-points/extension-point-registry.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-schema.d.ts +9 -0
- package/lib/utils/extension-points/extension-point-schema.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-schemas.d.ts +92 -0
- package/lib/utils/extension-points/extension-point-schemas.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-transforms.d.ts +21 -0
- package/lib/utils/extension-points/extension-point-transforms.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-types.d.ts +162 -0
- package/lib/utils/extension-points/extension-point-types.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-validation.d.ts +43 -0
- package/lib/utils/extension-points/extension-point-validation.d.ts.map +1 -0
- package/lib/utils/extension-points/json-extension-parser.d.ts +68 -0
- package/lib/utils/extension-points/json-extension-parser.d.ts.map +1 -0
- package/lib/utils/extension-points/type-generator.d.ts +43 -0
- package/lib/utils/extension-points/type-generator.d.ts.map +1 -0
- package/lib/utils/index.d.ts +10 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts +15 -0
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-registry-init.d.ts +2 -0
- package/lib/utils/plugin-system/plugin-extension-registry-init.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-registry.d.ts +6 -0
- package/lib/utils/plugin-system/plugin-extension-registry.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-reducer.d.ts +17 -0
- package/lib/utils/plugin-system/plugin-reducer.d.ts.map +1 -0
- package/lib/utils/plugin-system/resolve-best-extension.d.ts +12 -0
- package/lib/utils/plugin-system/resolve-best-extension.d.ts.map +1 -0
- package/lib/utils/processors/contribution-reducer.d.ts +5 -0
- package/lib/utils/processors/contribution-reducer.d.ts.map +1 -0
- package/lib/utils/processors/initialize-plugins.d.ts +82 -0
- package/lib/utils/processors/initialize-plugins.d.ts.map +1 -0
- package/lib/utils/processors/initialize-simplified-extensions.d.ts +13 -0
- package/lib/utils/processors/initialize-simplified-extensions.d.ts.map +1 -0
- package/lib/utils/processors/process-kos-config.d.ts +34 -0
- package/lib/utils/processors/process-kos-config.d.ts.map +1 -0
- package/lib/utils/processors/simplified-contribution-processor.d.ts +14 -0
- package/lib/utils/processors/simplified-contribution-processor.d.ts.map +1 -0
- package/lib/webpack/index.d.ts +2 -0
- package/lib/webpack/index.d.ts.map +1 -0
- package/lib/webpack/with-kos-config.d.ts +2 -0
- package/lib/webpack/with-kos-config.d.ts.map +1 -0
- package/package.json +30 -0
- package/types/global.d.ts +53 -0
- package/types/plugins.d.ts +41 -0
- package/utils.cjs +2 -0
- package/utils.cjs.map +1 -0
- package/utils.js +296 -0
- package/utils.js.map +1 -0
- package/webpack.cjs +13 -0
- package/webpack.cjs.map +1 -0
- package/webpack.js +795 -0
- package/webpack.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentation-generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/discovery/documentation-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,YAAY,EAAE,MAAM,CAAC;QACrB,yBAAyB,EAAE,MAAM,CAAC;QAClC,qBAAqB,EAAE,MAAM,CAAC;KAC/B,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAC9B,UAAU,EAAE,oBAAoB,GAAG,SAAS,EAC5C,OAAO,GAAE,oBAAyB,GACjC,sBAAsB;IAkDzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAkB7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAqBtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IA0BtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IA6D5C;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,cAAc,EAAE,kBAAkB,GAAG,MAAM;IA8ExE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAsCjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAwC1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IA4G5C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAuC7C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA4CxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,8BAA8B;IA6C7C,OAAO,CAAC,MAAM,CAAC,2BAA2B;IA6B1C,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAIxC,OAAO,CAAC,MAAM,CAAC,cAAc;IAa7B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA+BnC,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAexC,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAevC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAkB7C,OAAO,CAAC,MAAM,CAAC,iBAAiB;CA8BjC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { PluginExtension, PluginExtensionsType } from '../../../types/plugins';
|
|
2
|
+
|
|
3
|
+
export interface ExtensionPointInfo {
|
|
4
|
+
id: string;
|
|
5
|
+
displayName?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
source: "simplified" | "legacy";
|
|
8
|
+
metadata?: {
|
|
9
|
+
category?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
since?: string;
|
|
12
|
+
deprecated?: boolean;
|
|
13
|
+
owner?: string;
|
|
14
|
+
};
|
|
15
|
+
pluginCount: number;
|
|
16
|
+
plugins: PluginExtension[];
|
|
17
|
+
}
|
|
18
|
+
export interface PluginHealthStats {
|
|
19
|
+
totalExtensionPoints: number;
|
|
20
|
+
extensionPointsWithPlugins: number;
|
|
21
|
+
totalPlugins: number;
|
|
22
|
+
simplifiedExtensionPoints: number;
|
|
23
|
+
legacyExtensionPoints: number;
|
|
24
|
+
deprecatedExtensionPoints: number;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginDiscoveryOptions {
|
|
27
|
+
includeLegacyExtensions?: boolean;
|
|
28
|
+
includeEmptyExtensionPoints?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface PluginDescriptorValidationResult {
|
|
31
|
+
isValid: boolean;
|
|
32
|
+
errors: string[];
|
|
33
|
+
warnings: string[];
|
|
34
|
+
missingRequired: string[];
|
|
35
|
+
suggestions: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface CompatibilityCheckResult {
|
|
38
|
+
isCompatible: boolean;
|
|
39
|
+
issues: string[];
|
|
40
|
+
missingExtensionPoints: string[];
|
|
41
|
+
incompatibleTypes: string[];
|
|
42
|
+
suggestions: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface PluginDescriptor {
|
|
45
|
+
id: string;
|
|
46
|
+
init?: boolean;
|
|
47
|
+
contributes?: {
|
|
48
|
+
[key: string]: any[];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Plugin Discovery Service - Core business logic for plugin analysis
|
|
53
|
+
*/
|
|
54
|
+
export declare class PluginDiscoveryService {
|
|
55
|
+
/**
|
|
56
|
+
* Get all extension points with their plugin information
|
|
57
|
+
*/
|
|
58
|
+
static getExtensionPoints(extensions: PluginExtensionsType | undefined, options?: PluginDiscoveryOptions): ExtensionPointInfo[];
|
|
59
|
+
/**
|
|
60
|
+
* Filter extension points based on search criteria
|
|
61
|
+
*/
|
|
62
|
+
static filterExtensionPoints(extensionPoints: ExtensionPointInfo[], searchTerm: string): ExtensionPointInfo[];
|
|
63
|
+
/**
|
|
64
|
+
* Calculate health statistics for the plugin system
|
|
65
|
+
*/
|
|
66
|
+
static calculateHealthStats(extensionPoints: ExtensionPointInfo[]): PluginHealthStats;
|
|
67
|
+
/**
|
|
68
|
+
* Analyze a specific plugin for health and capabilities
|
|
69
|
+
*/
|
|
70
|
+
static analyzePlugin(plugin: PluginExtension): {
|
|
71
|
+
hasComponent: boolean;
|
|
72
|
+
hasRank: boolean;
|
|
73
|
+
healthStatus: "healthy" | "warning" | "error";
|
|
74
|
+
capabilities: string[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Get extension point by ID with detailed information
|
|
78
|
+
*/
|
|
79
|
+
static getExtensionPointById(extensionPoints: ExtensionPointInfo[], id: string): ExtensionPointInfo | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Validate if an extension point ID follows conventions
|
|
82
|
+
*/
|
|
83
|
+
static validateExtensionPointId(id: string): {
|
|
84
|
+
isValid: boolean;
|
|
85
|
+
issues: string[];
|
|
86
|
+
suggestions: string[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Validate a plugin descriptor structure and content
|
|
90
|
+
*/
|
|
91
|
+
static validatePluginDescriptor(descriptor: PluginDescriptor): PluginDescriptorValidationResult;
|
|
92
|
+
/**
|
|
93
|
+
* Check compatibility between plugin contributions and available extension points
|
|
94
|
+
*/
|
|
95
|
+
static checkPluginCompatibility(pluginDescriptor: PluginDescriptor, availableExtensionPoints: ExtensionPointInfo[]): CompatibilityCheckResult;
|
|
96
|
+
/**
|
|
97
|
+
* Map contribution keys to their expected extension point IDs
|
|
98
|
+
*/
|
|
99
|
+
private static getExpectedExtensionPoints;
|
|
100
|
+
/**
|
|
101
|
+
* Get comprehensive plugin analysis including validation and compatibility
|
|
102
|
+
*/
|
|
103
|
+
static analyzePluginDescriptor(descriptor: PluginDescriptor, availableExtensionPoints: ExtensionPointInfo[]): {
|
|
104
|
+
validation: PluginDescriptorValidationResult;
|
|
105
|
+
compatibility: CompatibilityCheckResult;
|
|
106
|
+
recommendations: string[];
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=plugin-discovery-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-discovery-service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/discovery/plugin-discovery-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,YAAY,GAAG,QAAQ,CAAC;IAChC,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,uBAAuB,CAAC,EAAE,OAAO,CAA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,CAAC;KACxB;IAkDD;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAC1B,eAAe,EAAE,kBAAkB,EAAE,EACrC,EAAE,EAAE,MAAM,GACT,kBAAkB,GAAG,SAAS;IAIjC;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG;QAC3C,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IA+CD;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAC7B,UAAU,EAAE,gBAAgB,GAC3B,gCAAgC;IA4FnC;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAC7B,gBAAgB,EAAE,gBAAgB,EAClC,wBAAwB,EAAE,kBAAkB,EAAE,GAC7C,wBAAwB;IAmF3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAiBzC;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,UAAU,EAAE,gBAAgB,EAC5B,wBAAwB,EAAE,kBAAkB,EAAE,GAC7C;QACD,UAAU,EAAE,gCAAgC,CAAC;QAC7C,aAAa,EAAE,wBAAwB,CAAC;QACxC,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B;CAoCF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ExtensionPointConfig, ExtensionPointDefinition, ViewExtensionPointDefinition } from './extension-point-types';
|
|
2
|
+
|
|
3
|
+
export type { ExtensionComponentProps, ExtensionPointConfig, ExtensionPointDefinition, SchemaFieldInfo, TransformContext, ValidationContext, ViewExtensionPointDefinition, } from './extension-point-types';
|
|
4
|
+
export { getExtensionPointRegistry, getExtensionPointSchema, registry, } from './extension-point-registry';
|
|
5
|
+
export { createViewAwareTransform } from './extension-point-transforms';
|
|
6
|
+
export { extensionPointId } from './extension-point-types';
|
|
7
|
+
export { getValidationResults } from './extension-point-validation';
|
|
8
|
+
/**
|
|
9
|
+
* Define a new extension point with simplified API
|
|
10
|
+
*
|
|
11
|
+
* Returns an extension point definition that must be explicitly registered
|
|
12
|
+
* by calling the register() method. This prevents automatic registration
|
|
13
|
+
* and circular dependency issues.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Simple extension point
|
|
18
|
+
* export const MyFeatureExtension = defineExtensionPoint({
|
|
19
|
+
* id: 'ddk.myFeature',
|
|
20
|
+
* contributionKey: 'myFeature',
|
|
21
|
+
* displayName: 'My Feature',
|
|
22
|
+
* description: 'Extension point for custom features'
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Register it explicitly in your app initialization
|
|
26
|
+
* MyFeatureExtension.register();
|
|
27
|
+
*
|
|
28
|
+
* // Extension point with view support
|
|
29
|
+
* export const MyViewExtension = defineExtensionPoint({
|
|
30
|
+
* id: 'ddk.myView.config',
|
|
31
|
+
* contributionKey: 'myView',
|
|
32
|
+
* hasView: true,
|
|
33
|
+
* relatedPoints: {
|
|
34
|
+
* view: 'ddk.myView.view',
|
|
35
|
+
* definition: 'ddk.myView'
|
|
36
|
+
* },
|
|
37
|
+
* transform: (data, context) => ({
|
|
38
|
+
* ...data,
|
|
39
|
+
* processedAt: Date.now()
|
|
40
|
+
* })
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Register it explicitly in your app initialization
|
|
44
|
+
* MyViewExtension.register();
|
|
45
|
+
*
|
|
46
|
+
* // Use the pre-configured component (for view-based extensions)
|
|
47
|
+
* <MyViewExtension.Component
|
|
48
|
+
* module="specific-module-id"
|
|
49
|
+
* fallback={<div>Loading...</div>}
|
|
50
|
+
* customProp="value"
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function defineExtensionPoint<TData = any, TProcessed = TData, TProps = any>(config: ExtensionPointConfig<TData, TProcessed, TProps> & {
|
|
55
|
+
hasView: true;
|
|
56
|
+
}): ViewExtensionPointDefinition<TData, TProcessed, TProps>;
|
|
57
|
+
export declare function defineExtensionPoint<TData = any, TProcessed = TData, TProps = any>(config: ExtensionPointConfig<TData, TProcessed, TProps>): ExtensionPointDefinition<TData, TProcessed, TProps>;
|
|
58
|
+
//# sourceMappingURL=define-extension-point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-extension-point.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/define-extension-point.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,wBAAgB,oBAAoB,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAC1E,4BAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAG3D,wBAAgB,oBAAoB,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Creating a new extension point using the simplified API
|
|
3
|
+
*
|
|
4
|
+
* This file demonstrates how to create an extension point with the new
|
|
5
|
+
* defineExtensionPoint API. This is just for reference and testing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AnalyticsWidgetExtension: import('./extension-point-types').ExtensionPointDefinition<any, any, any>;
|
|
8
|
+
export declare const CustomReportExtension: import('./extension-point-types').ViewExtensionPointDefinition<any, any, any>;
|
|
9
|
+
interface NotificationConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
type: "info" | "warning" | "error" | "success";
|
|
12
|
+
title: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
duration?: number;
|
|
15
|
+
actions?: Array<{
|
|
16
|
+
label: string;
|
|
17
|
+
action: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
interface ProcessedNotificationConfig extends NotificationConfig {
|
|
21
|
+
_meta: {
|
|
22
|
+
registeredAt: number;
|
|
23
|
+
source: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const NotificationExtension: import('./extension-point-types').ExtensionPointDefinition<NotificationConfig, ProcessedNotificationConfig, any>;
|
|
27
|
+
export {};
|
|
28
|
+
/**
|
|
29
|
+
* How to use these extension points in a component:
|
|
30
|
+
*
|
|
31
|
+
* ```tsx
|
|
32
|
+
* import { DynamicComponent } from '@kosdev-code/kos-ui-plugin';
|
|
33
|
+
* import { AnalyticsWidgetExtension } from './example-extension-point';
|
|
34
|
+
*
|
|
35
|
+
* function MyDashboard() {
|
|
36
|
+
* return (
|
|
37
|
+
* <div>
|
|
38
|
+
* <DynamicComponent
|
|
39
|
+
* extension={AnalyticsWidgetExtension.id}
|
|
40
|
+
* props={{ dashboardId: 'main' }}
|
|
41
|
+
* fallback={<div>Loading analytics...</div>}
|
|
42
|
+
* />
|
|
43
|
+
* </div>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* How a plugin would contribute to this extension point:
|
|
49
|
+
*
|
|
50
|
+
* kosdev-plugin.json:
|
|
51
|
+
* ```json
|
|
52
|
+
* {
|
|
53
|
+
* "id": "my-analytics-plugin",
|
|
54
|
+
* "contributes": {
|
|
55
|
+
* "analyticsWidgets": [
|
|
56
|
+
* {
|
|
57
|
+
* "id": "sales-widget",
|
|
58
|
+
* "title": "Sales Analytics",
|
|
59
|
+
* "rank": 10,
|
|
60
|
+
* "component": "./SalesWidget"
|
|
61
|
+
* }
|
|
62
|
+
* ]
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
//# sourceMappingURL=example-extension-point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example-extension-point.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/example-extension-point.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,eAAO,MAAM,wBAAwB,2EAWnC,CAAC;AAGH,eAAO,MAAM,qBAAqB,+EA8BhC,CAAC;AAGH,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,UAAU,2BAA4B,SAAQ,kBAAkB;IAC9D,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,kHA4BhC,CAAC;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ExtensionPointConfig, ExtensionPointDefinition } from './extension-point-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Registry for simplified extension points
|
|
5
|
+
* Keeps track of all extension points defined via this API
|
|
6
|
+
*/
|
|
7
|
+
export declare class SimplifiedExtensionPointRegistry {
|
|
8
|
+
private extensionPoints;
|
|
9
|
+
define<TData = any, TProcessed = TData, TProps = any>(config: ExtensionPointConfig<TData, TProcessed, TProps>): ExtensionPointDefinition<TData, TProcessed, TProps>;
|
|
10
|
+
private createReducer;
|
|
11
|
+
/**
|
|
12
|
+
* Get all registered extension points (for discovery/documentation)
|
|
13
|
+
*/
|
|
14
|
+
getAllExtensionPoints(): ExtensionPointDefinition[];
|
|
15
|
+
/**
|
|
16
|
+
* Get all defined extension points (registered and unregistered)
|
|
17
|
+
*/
|
|
18
|
+
getAllDefinedExtensionPoints(): ExtensionPointDefinition[];
|
|
19
|
+
/**
|
|
20
|
+
* Get a specific extension point definition
|
|
21
|
+
*/
|
|
22
|
+
getExtensionPoint(id: string): ExtensionPointDefinition | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Check if an extension point is registered
|
|
25
|
+
*/
|
|
26
|
+
hasExtensionPoint(id: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get the Zod schema for an extension point
|
|
29
|
+
* Returns undefined if the extension point doesn't have a schema
|
|
30
|
+
*/
|
|
31
|
+
getExtensionPointSchema(id: string): any | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare const registry: SimplifiedExtensionPointRegistry;
|
|
34
|
+
/**
|
|
35
|
+
* Get the simplified extension point registry
|
|
36
|
+
* Useful for discovery tools and documentation generation
|
|
37
|
+
*/
|
|
38
|
+
export declare function getExtensionPointRegistry(): SimplifiedExtensionPointRegistry;
|
|
39
|
+
/**
|
|
40
|
+
* Get the Zod schema for an extension point by ID
|
|
41
|
+
* Useful for inferring TypeScript types from JSON-defined extension points
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { getExtensionPointSchema } from '@kosdev-code/kos-ui-plugin';
|
|
46
|
+
* import { z } from 'zod';
|
|
47
|
+
*
|
|
48
|
+
* // Get the schema
|
|
49
|
+
* const schema = getExtensionPointSchema('app.navigation.link');
|
|
50
|
+
*
|
|
51
|
+
* // Infer the TypeScript type
|
|
52
|
+
* type NavLinkData = z.infer<typeof schema>;
|
|
53
|
+
*
|
|
54
|
+
* // Use it with hooks
|
|
55
|
+
* const { extensions, t } = useExtensionI18n<NavLinkData>(EXTENSION_ID_NAV_LINK);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function getExtensionPointSchema(id: string): any | undefined;
|
|
59
|
+
//# sourceMappingURL=extension-point-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-registry.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAMjC;;;GAGG;AACH,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,eAAe,CAAoD;IAE3E,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,KAAK,EAAE,MAAM,GAAG,GAAG,EAClD,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC;IAiDtD,OAAO,CAAC,aAAa;IAgKrB;;OAEG;IACH,qBAAqB,IAAI,wBAAwB,EAAE;IAMnD;;OAEG;IACH,4BAA4B,IAAI,wBAAwB,EAAE;IAI1D;;OAEG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAInE;;OAEG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAItC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;CAIrD;AAGD,eAAO,MAAM,QAAQ,kCAAyC,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,gCAAgC,CAE5E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAEnE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SchemaFieldInfo } from './extension-point-types';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Extract field information from a Zod schema for documentation purposes
|
|
6
|
+
* Returns field information that is safe to display in Plugin Explorer
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractSchemaFieldInfo(schema: z.ZodSchema): SchemaFieldInfo[];
|
|
9
|
+
//# sourceMappingURL=extension-point-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-schema.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG,eAAe,EAAE,CA4C7E"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ValidationContext } from './define-extension-point';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base schema for view-based DDK extension points
|
|
6
|
+
* Contains common fields that all DDK extension points share
|
|
7
|
+
*/
|
|
8
|
+
export declare const BaseViewExtensionSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
title: z.ZodString;
|
|
11
|
+
namespace: z.ZodString;
|
|
12
|
+
experienceId: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
experienceId: string;
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
namespace: string;
|
|
18
|
+
}, {
|
|
19
|
+
experienceId: string;
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
namespace: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Base schema with optional ranking support
|
|
26
|
+
*/
|
|
27
|
+
export declare const RankableViewExtensionSchema: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
title: z.ZodString;
|
|
30
|
+
namespace: z.ZodString;
|
|
31
|
+
experienceId: z.ZodString;
|
|
32
|
+
} & {
|
|
33
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
experienceId: string;
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
namespace: string;
|
|
39
|
+
rank?: number | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
experienceId: string;
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
namespace: string;
|
|
45
|
+
rank?: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Performs standard Zod validation and adds errors to the validation context
|
|
49
|
+
*
|
|
50
|
+
* @param schema The Zod schema to validate against
|
|
51
|
+
* @param data The data to validate
|
|
52
|
+
* @param context The validation context to add errors to
|
|
53
|
+
* @returns true if validation passed, false if errors were added
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: unknown, context: ValidationContext): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Common validation for descriptor fields that should use dot notation
|
|
58
|
+
*
|
|
59
|
+
* @param descriptorField The name of the descriptor field (e.g., "setupDescriptor", "cuiDescriptor")
|
|
60
|
+
* @param descriptorValue The value of the descriptor field
|
|
61
|
+
* @param context The validation context to add warnings to
|
|
62
|
+
*/
|
|
63
|
+
export declare function validateDescriptorFormat(descriptorField: string, descriptorValue: string | undefined, context: ValidationContext): void;
|
|
64
|
+
/**
|
|
65
|
+
* Common validation for rank values to ensure they're reasonable
|
|
66
|
+
*
|
|
67
|
+
* @param rank The rank value to validate
|
|
68
|
+
* @param context The validation context to add warnings to
|
|
69
|
+
* @param maxReasonableRank The maximum reasonable rank value (default 1000)
|
|
70
|
+
*/
|
|
71
|
+
export declare function validateRank(rank: number | undefined, context: ValidationContext, maxReasonableRank?: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Helper to create extension-specific schemas by extending the base
|
|
74
|
+
* and adding custom fields
|
|
75
|
+
*
|
|
76
|
+
* @param additionalFields Additional fields specific to this extension point
|
|
77
|
+
* @param options Options for schema creation
|
|
78
|
+
* @returns Extended schema with base fields and additional fields
|
|
79
|
+
*/
|
|
80
|
+
export declare function createExtensionSchema<T extends z.ZodRawShape>(additionalFields: T, options?: {
|
|
81
|
+
rankable?: boolean;
|
|
82
|
+
}): z.ZodObject<z.objectUtil.extendShape<(typeof BaseViewExtensionSchema)["shape"] | (typeof RankableViewExtensionSchema)["shape"], T>>;
|
|
83
|
+
/**
|
|
84
|
+
* Type-safe validation for rankable extensions
|
|
85
|
+
* Only validates rank if the data has a rank property
|
|
86
|
+
*/
|
|
87
|
+
export declare function validateRankIfPresent(data: unknown, context: ValidationContext, maxReasonableRank?: number): void;
|
|
88
|
+
/**
|
|
89
|
+
* Type helper for inferring types from extension schemas
|
|
90
|
+
*/
|
|
91
|
+
export type InferExtensionSchema<T extends z.ZodTypeAny> = z.infer<T>;
|
|
92
|
+
//# sourceMappingURL=extension-point-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-schemas.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAiBlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;EAOtC,CAAC;AAEH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAST;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAMN;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,iBAAiB,EAC1B,iBAAiB,SAAO,GACvB,IAAI,CAMN;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAC3D,gBAAgB,EAAE,CAAC,EACnB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,CAAC,CAAC,SAAS,CACZ,CAAC,CAAC,UAAU,CAAC,WAAW,CACpB,CAAC,OAAO,uBAAuB,CAAC,CAAC,OAAO,CAAC,GACzC,CAAC,OAAO,2BAA2B,CAAC,CAAC,OAAO,CAAC,EAC/C,CAAC,CACF,CACF,CAKA;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,iBAAiB,EAC1B,iBAAiB,SAAO,GACvB,IAAI,CAKN;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TransformContext } from './extension-point-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generic transform helper for extension points that use the experience/view pattern
|
|
5
|
+
* Handles mapping experience IDs to experience data and flattening component properties
|
|
6
|
+
*/
|
|
7
|
+
export declare function createViewAwareTransform<TData extends Record<string, any>>(options?: {
|
|
8
|
+
/**
|
|
9
|
+
* Property name that contains the experience ID (default: "experienceId")
|
|
10
|
+
*/
|
|
11
|
+
experienceIdProperty?: keyof TData;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to flatten component properties to root level for useDynamicComponent compatibility (default: true)
|
|
14
|
+
*/
|
|
15
|
+
flattenComponentProperties?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Additional transform logic to apply after view mapping
|
|
18
|
+
*/
|
|
19
|
+
customTransform?: (data: TData, view: any, context: TransformContext) => any;
|
|
20
|
+
}): (data: TData, context: TransformContext) => any;
|
|
21
|
+
//# sourceMappingURL=extension-point-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-transforms.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-transforms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxE,OAAO,GAAE;IACP;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,KAAK,CAAC;IACnC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,eAAe,CAAC,EAAE,CAChB,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,gBAAgB,KACtB,GAAG,CAAC;CACL,UAQQ,KAAK,WAAW,gBAAgB,SA4B/C"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { BasePluginExtension, PluginExtensionsType, ProcessedContributions } from '../../../types/plugins';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Validation context for collecting validation issues
|
|
6
|
+
*/
|
|
7
|
+
export interface ValidationContext {
|
|
8
|
+
addError(message: string): void;
|
|
9
|
+
addWarning(message: string): void;
|
|
10
|
+
addInfo(message: string): void;
|
|
11
|
+
hasErrors(): boolean;
|
|
12
|
+
hasIssues(): boolean;
|
|
13
|
+
getIssues(): {
|
|
14
|
+
type: "error" | "warning" | "info";
|
|
15
|
+
message: string;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Context provided to transform functions
|
|
20
|
+
*/
|
|
21
|
+
export interface TransformContext {
|
|
22
|
+
remote: string;
|
|
23
|
+
sectionId: string;
|
|
24
|
+
experiences?: Record<string, any>;
|
|
25
|
+
contributions: ProcessedContributions;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Schema field information for documentation
|
|
29
|
+
*/
|
|
30
|
+
export interface SchemaFieldInfo {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
type?: string;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for defining a new extension point
|
|
38
|
+
*/
|
|
39
|
+
export interface ExtensionPointConfig<TData = any, TProcessed = TData, _TProps = any> {
|
|
40
|
+
/**
|
|
41
|
+
* Unique identifier for this extension point
|
|
42
|
+
* Convention: "ddk.{feature}" or "ddk.{feature}.{sub-feature}"
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional display name for documentation/discovery
|
|
47
|
+
*/
|
|
48
|
+
displayName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Optional description for documentation/discovery
|
|
51
|
+
*/
|
|
52
|
+
description?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The contribution key in the plugin descriptor
|
|
55
|
+
* e.g., "myFeature" maps to contributes.myFeature in kosdev-plugin.json
|
|
56
|
+
*/
|
|
57
|
+
contributionKey: string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional related extension points
|
|
60
|
+
* For example, a main extension might have .view and .definition variants
|
|
61
|
+
*/
|
|
62
|
+
relatedPoints?: {
|
|
63
|
+
view?: string;
|
|
64
|
+
definition?: string;
|
|
65
|
+
[key: string]: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Transform function to process raw contribution data
|
|
69
|
+
* Allows custom processing logic while maintaining type safety
|
|
70
|
+
*/
|
|
71
|
+
transform?: (data: TData, context: TransformContext) => TProcessed;
|
|
72
|
+
/**
|
|
73
|
+
* Optional validation function
|
|
74
|
+
* Use context.addError/addWarning/addInfo to collect validation issues
|
|
75
|
+
* Return "skip" to skip processing this contribution
|
|
76
|
+
*/
|
|
77
|
+
validate?: (data: TData, context: ValidationContext) => "skip" | void;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this extension point uses view/experience pattern
|
|
80
|
+
* Default: false
|
|
81
|
+
*/
|
|
82
|
+
hasView?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether contributions should be ranked
|
|
85
|
+
* Default: false
|
|
86
|
+
*/
|
|
87
|
+
isRankable?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Optional Zod schema for runtime validation and documentation
|
|
90
|
+
* Provides both type safety and field introspection for Plugin Explorer
|
|
91
|
+
*/
|
|
92
|
+
schema?: z.ZodSchema<TData>;
|
|
93
|
+
/**
|
|
94
|
+
* Metadata for discovery/documentation
|
|
95
|
+
*/
|
|
96
|
+
metadata?: {
|
|
97
|
+
category?: string;
|
|
98
|
+
tags?: string[];
|
|
99
|
+
since?: string;
|
|
100
|
+
deprecated?: boolean;
|
|
101
|
+
replacedBy?: string;
|
|
102
|
+
owner?: string;
|
|
103
|
+
/**
|
|
104
|
+
* The actual export name of this extension point in the code
|
|
105
|
+
* Used for documentation generation to show correct import statements
|
|
106
|
+
*/
|
|
107
|
+
exportName?: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Props for extension point components
|
|
112
|
+
*/
|
|
113
|
+
export interface ExtensionComponentProps {
|
|
114
|
+
/** Specific module to load (optional) */
|
|
115
|
+
module?: string;
|
|
116
|
+
/** Fallback component when extension not found */
|
|
117
|
+
fallback?: React.ReactNode;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Result of defining an extension point
|
|
121
|
+
*/
|
|
122
|
+
export interface ExtensionPointDefinition<TData = any, TProcessed = TData, TProps = any> {
|
|
123
|
+
/**
|
|
124
|
+
* The extension point configuration
|
|
125
|
+
*/
|
|
126
|
+
config: ExtensionPointConfig<TData, TProcessed, TProps>;
|
|
127
|
+
/**
|
|
128
|
+
* Extension point ID for use in components
|
|
129
|
+
*/
|
|
130
|
+
id: string;
|
|
131
|
+
/**
|
|
132
|
+
* Helper to get typed extensions (for future use with hooks)
|
|
133
|
+
*/
|
|
134
|
+
getExtensions?: (extensions: PluginExtensionsType) => Record<string, BasePluginExtension & {
|
|
135
|
+
data: TProcessed;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Registration status
|
|
139
|
+
*/
|
|
140
|
+
isRegistered: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Method to register this extension point
|
|
143
|
+
*/
|
|
144
|
+
register: () => void;
|
|
145
|
+
/**
|
|
146
|
+
* Get schema field information for documentation purposes
|
|
147
|
+
* Returns field info that can be safely displayed by Plugin Explorer
|
|
148
|
+
*/
|
|
149
|
+
getSchemaFieldInfo?: () => SchemaFieldInfo[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Extension point with hasView: true, guarantees Component property
|
|
153
|
+
*/
|
|
154
|
+
export interface ViewExtensionPointDefinition<TData = any, TProcessed = TData, TProps = any> extends ExtensionPointDefinition<TData, TProcessed, TProps> {
|
|
155
|
+
Component: React.ComponentType<ExtensionComponentProps & TProps>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Type-safe extension point ID helper
|
|
159
|
+
* Ensures consistent naming and helps with refactoring
|
|
160
|
+
*/
|
|
161
|
+
export declare function extensionPointId(namespace: string, feature: string, ...subFeatures: string[]): string;
|
|
162
|
+
//# sourceMappingURL=extension-point-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-types.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,IAAI,OAAO,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