@kosdev-code/kos-ui-plugin 2.1.1 → 2.1.3
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-BVDETA08.js +1523 -0
- package/documentation-generator-BVDETA08.js.map +1 -0
- package/documentation-generator-CTsesVKL.cjs +266 -0
- package/documentation-generator-CTsesVKL.cjs.map +1 -0
- package/index.cjs +16 -16
- package/index.cjs.map +1 -1
- package/index.js +433 -413
- package/index.js.map +1 -1
- package/lib/hooks/use-extension-component.d.ts +5 -0
- package/lib/hooks/use-extension-component.d.ts.map +1 -1
- package/lib/utils/extension-points/extension-point-schemas.d.ts +8 -8
- 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/plugin-system/plugin-extension-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/types/global.d.ts +15 -1
- package/utils.cjs +1 -1
- package/utils.cjs.map +1 -1
- package/utils.js +60 -80
- package/utils.js.map +1 -1
- package/documentation-generator-B8FuhDjB.js +0 -1271
- package/documentation-generator-B8FuhDjB.js.map +0 -1
- package/documentation-generator-E9tFyId_.cjs +0 -266
- package/documentation-generator-E9tFyId_.cjs.map +0 -1
|
@@ -18,4 +18,9 @@ export declare function useExtensionComponent<TData = any, TProcessed = TData, T
|
|
|
18
18
|
* Alternative to the hook for non-hook contexts
|
|
19
19
|
*/
|
|
20
20
|
export declare function createExtensionComponent<TData = any, TProcessed = TData, TProps = any>(definition: ExtensionPointDefinition<TData, TProcessed, TProps>): React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Hook that creates a React component for an extension point by ID
|
|
23
|
+
* Useful for JSON-defined extension points where you only have the string ID
|
|
24
|
+
*/
|
|
25
|
+
export declare function useExtensionComponentById<TProps = any>(extensionPointId: string): React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
21
26
|
//# sourceMappingURL=use-extension-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-extension-component.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-extension-component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"use-extension-component.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-extension-component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAGhG;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,UAAU,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAC9D,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAyB9D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,UAAU,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAC9D,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAuB9D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,GAAG,GAAG,EACpD,gBAAgB,EAAE,MAAM,GACvB,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAiC9D"}
|
|
@@ -11,14 +11,14 @@ export declare const BaseViewExtensionSchema: z.ZodObject<{
|
|
|
11
11
|
namespace: z.ZodString;
|
|
12
12
|
experienceId: z.ZodString;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
title: string;
|
|
15
|
-
id: string;
|
|
16
14
|
experienceId: string;
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
17
|
namespace: string;
|
|
18
18
|
}, {
|
|
19
|
-
title: string;
|
|
20
|
-
id: string;
|
|
21
19
|
experienceId: string;
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
22
|
namespace: string;
|
|
23
23
|
}>;
|
|
24
24
|
/**
|
|
@@ -32,15 +32,15 @@ export declare const RankableViewExtensionSchema: z.ZodObject<{
|
|
|
32
32
|
} & {
|
|
33
33
|
rank: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
title: string;
|
|
36
|
-
id: string;
|
|
37
35
|
experienceId: string;
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
38
|
namespace: string;
|
|
39
39
|
rank?: number | undefined;
|
|
40
40
|
}, {
|
|
41
|
-
title: string;
|
|
42
|
-
id: string;
|
|
43
41
|
experienceId: string;
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
44
|
namespace: string;
|
|
45
45
|
rank?: number | undefined;
|
|
46
46
|
}>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ExtensionPointConfig } from './extension-point-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSON representation of an extension point definition
|
|
5
|
+
*/
|
|
6
|
+
export interface JsonExtensionPointDefinition {
|
|
7
|
+
id: string;
|
|
8
|
+
displayName?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
contributionKey: string;
|
|
11
|
+
hasView?: boolean;
|
|
12
|
+
isRankable?: boolean;
|
|
13
|
+
relatedPoints?: Record<string, string>;
|
|
14
|
+
schema?: JsonContributionSchema;
|
|
15
|
+
validation?: JsonValidationRules;
|
|
16
|
+
transform?: JsonTransformOperations;
|
|
17
|
+
metadata?: JsonExtensionPointMetadata;
|
|
18
|
+
}
|
|
19
|
+
interface JsonContributionSchema {
|
|
20
|
+
type?: string;
|
|
21
|
+
properties?: Record<string, unknown>;
|
|
22
|
+
required?: string[];
|
|
23
|
+
additionalProperties?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface JsonValidationRules {
|
|
26
|
+
rules?: JsonValidationRule[];
|
|
27
|
+
module?: string;
|
|
28
|
+
}
|
|
29
|
+
interface JsonValidationRule {
|
|
30
|
+
type: "required" | "range" | "pattern" | "custom" | "dependency";
|
|
31
|
+
field?: string;
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
pattern?: string;
|
|
35
|
+
message?: string;
|
|
36
|
+
dependsOn?: string;
|
|
37
|
+
expression?: string;
|
|
38
|
+
}
|
|
39
|
+
interface JsonTransformOperations {
|
|
40
|
+
addFields?: Record<string, unknown>;
|
|
41
|
+
removeFields?: string[];
|
|
42
|
+
renameFields?: Record<string, string>;
|
|
43
|
+
normalizeFields?: Array<{
|
|
44
|
+
field: string;
|
|
45
|
+
operation: "trim" | "lowercase" | "uppercase" | "camelCase" | "kebabCase";
|
|
46
|
+
}>;
|
|
47
|
+
module?: string;
|
|
48
|
+
}
|
|
49
|
+
interface JsonExtensionPointMetadata {
|
|
50
|
+
category?: string;
|
|
51
|
+
tags?: string[];
|
|
52
|
+
owner?: string;
|
|
53
|
+
since?: string;
|
|
54
|
+
deprecated?: boolean;
|
|
55
|
+
deprecatedSince?: string;
|
|
56
|
+
replacedBy?: string;
|
|
57
|
+
exportName?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parse a JSON extension point definition into an ExtensionPointConfig
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseJsonExtensionPoint<TData = any, TProcessed = TData>(jsonDef: JsonExtensionPointDefinition): ExtensionPointConfig<TData, TProcessed>;
|
|
63
|
+
/**
|
|
64
|
+
* Parse all extension points from a .kos.json configuration
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseExtensionPointsFromConfig(kosConfig: Record<string, unknown>): Array<ExtensionPointConfig<unknown, unknown>>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=json-extension-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-extension-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/json-extension-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,yBAAyB,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC;AAED,UAAU,sBAAsB;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CA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B,uBAAuB,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,KAAK,EACrE,OAAO,EAAE,4BAA4B,GACpC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAwCzC;AA0bD;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAiB/C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { JsonExtensionPointDefinition } from './json-extension-parser';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generated TypeScript interface information
|
|
5
|
+
*/
|
|
6
|
+
export interface GeneratedTypeInfo {
|
|
7
|
+
interfaceName: string;
|
|
8
|
+
exportName: string;
|
|
9
|
+
properties: PropertyInfo[];
|
|
10
|
+
imports?: string[];
|
|
11
|
+
}
|
|
12
|
+
interface PropertyInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
optional?: boolean;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generate TypeScript interface from JSON extension point schema
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateTypeFromJsonSchema(extensionPoint: JsonExtensionPointDefinition): GeneratedTypeInfo;
|
|
22
|
+
/**
|
|
23
|
+
* Generate complete TypeScript definition file content
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateTypeDefinitionFile(extensionPoints: JsonExtensionPointDefinition[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Generate TypeScript definitions for a specific .kos.json file
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateTypesForKosConfig(kosConfig: Record<string, unknown>, packageName?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* CLI function to generate types from .kos.json file
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateTypesFromFile(kosJsonPath: string, outputPath?: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Batch generate types for multiple .kos.json files in a workspace
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateTypesForWorkspace(workspaceRoot: string, outputDir?: string): Promise<Array<{
|
|
38
|
+
package: string;
|
|
39
|
+
outputPath: string;
|
|
40
|
+
success: boolean;
|
|
41
|
+
}>>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=type-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/type-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,4BAA4B,GAC3C,iBAAiB,CAkCnB;AAsFD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,4BAA4B,EAAE,GAC9C,MAAM,CAiDR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAkBR;AAkBD;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CAgB3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-system/plugin-extension-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-system/plugin-extension-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACpD,aAAa,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC;CAChE;AAED,wBAAsB,iBAAiB,CACrC,eAAe,CAAC,EAAE,cAAc,GAC/B,OAAO,CAAC,WAAW,CAAC,CAgCtB;AAOD,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,sBAAsB,CAOxB;AAED,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,iCA0E5D;AAED,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,iCAG3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ui-plugin",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"kos": {
|
|
23
23
|
"build": {
|
|
24
|
-
"gitHash": "
|
|
24
|
+
"gitHash": "22bfa6b003918abbc473ab6b5cae1728e473a7e9"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
package/types/global.d.ts
CHANGED
|
@@ -5,6 +5,19 @@ export interface ViewContribution {
|
|
|
5
5
|
location: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export interface Extensions {
|
|
9
|
+
id: string;
|
|
10
|
+
displayName?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
contributionKey?: string;
|
|
13
|
+
hasView?: boolean;
|
|
14
|
+
isRankable?: boolean;
|
|
15
|
+
schema?: Record<string, unknown>;
|
|
16
|
+
validation?: Record<string, unknown>;
|
|
17
|
+
transform?: Record<string, unknown>;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
export interface BaseDefinition {
|
|
9
22
|
id: string;
|
|
10
23
|
title: string;
|
|
@@ -26,12 +39,13 @@ export interface Contributions {
|
|
|
26
39
|
};
|
|
27
40
|
}
|
|
28
41
|
|
|
29
|
-
interface DynamicRemote {
|
|
42
|
+
export interface DynamicRemote {
|
|
30
43
|
basePath: string;
|
|
31
44
|
remote: string;
|
|
32
45
|
extensions: Extensions[];
|
|
33
46
|
contributes: Contributions;
|
|
34
47
|
init?: boolean;
|
|
48
|
+
config?: Record<string, unknown>;
|
|
35
49
|
}
|
|
36
50
|
export interface DynamicRemotes {
|
|
37
51
|
[key: string]: DynamicRemote;
|
package/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./documentation-generator-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./documentation-generator-CTsesVKL.cjs");require("zod");function m(n,e,...t){return[n,e,...t].filter(Boolean).join(".")}function V(n){const e=n.match(/^(\d+)\.(\d+)\.\d+(?:-\S+)?$/);if(!e)throw new Error(`Invalid version format: ${n}`);const[t,s,l]=e;return`${s}.${l}.0`}function h(n,e){var c,u;e!=null&&e.sdkVersion&&console.log("sdkVersion",e.sdkVersion),e!=null&&e.ddkVersion&&console.log("ddkVersion",e.ddkVersion);const t=V((e==null?void 0:e.sdkVersion)||"0.2.0"),s=V((e==null?void 0:e.ddkVersion)||"0.2.0");console.log(`Using DDK version: ${s}`),console.log(`Using SDK version: ${t}`);const l=n==null?void 0:n.name;if(!l)throw new Error("KOS Configuration should be added. Project name not found in config");const i=((e==null?void 0:e.pluginPath)||"kosdev.ddk.ncui.plugin").split(".").reduce((a,o)=>(console.log(`Accessing key: ${o}`),a&&a[o]?a[o]:void 0),n),g=i==null?void 0:i.id;if(!g)throw new Error("KOS Configuration should be added. Plugin ID not found in config");const d=Object.keys(((c=i==null?void 0:i.contributes)==null?void 0:c.views)||{}).reduce((a,o)=>(i.contributes.views[o].forEach(f=>{a[`./${f.component}`]=f.location}),a),{});return Object.values(((u=i==null?void 0:i.contributes)==null?void 0:u.experiences)||{}).forEach(a=>{d[`./${a.component}`]=a.location}),i!=null&&i.init&&(d["./InitPlugin"]="./src/app/init.ts"),{name:l,exposes:d,library:{type:"var",name:g},additionalShared:[{libraryName:"@kosdev-code/kos-ui-plugin",sharedConfig:{singleton:!0,eager:!1,requiredVersion:`~${s}`}},{libraryName:"react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!0,requiredVersion:"18.2.0"}},{libraryName:"react-dom",sharedConfig:{singleton:!0,eager:!1,strictVersion:!0,requiredVersion:"18.2.0"}},{libraryName:"@kosdev-code/kos-ui-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-dispense-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-freestyle-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-ddk-components",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-model-components",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-models",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-styles",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@emotion/styled",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"~11.11.0"}},{libraryName:"@emotion/react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"~11.11.0"}},{libraryName:"reflect-metadata",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^0.2.2"}},{libraryName:"mobx",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^6.9.0"}},{libraryName:"loglevel",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^1.8.1"}},{libraryName:"robot3",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^0.4.0"}},{libraryName:"mobx-react-lite",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^3.4.3"}},{libraryName:"react-router-dom",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^6.11.2"}},{libraryName:"date-fns",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^2.30.0"}},{libraryName:"@use-gesture/react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^10.3.0"}},{libraryName:"@react-spring/web",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^9.7.3"}},{libraryName:"react-simple-keyboard",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^3.6.13"}},{libraryName:"expr-eval",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^2.0.2"}},{libraryName:"zod",sharedConfig:{singleton:!0,eager:!0,strictVersion:!1,requiredVersion:"^3.25.0"}}]}}exports.BaseViewExtensionSchema=r.BaseViewExtensionSchema;exports.DocumentationGenerator=r.DocumentationGenerator;exports.PluginDiscoveryService=r.PluginDiscoveryService;exports.RankableViewExtensionSchema=r.RankableViewExtensionSchema;exports.contributionReducer=r.contributionReducer;exports.createExtensionSchema=r.createExtensionSchema;exports.createViewAwareTransform=r.createViewAwareTransform;exports.defineExtensionPoint=r.defineExtensionPoint;exports.getContributions=r.getContributions;exports.getExtensionPointRegistry=r.getExtensionPointRegistry;exports.getExtensions=r.getExtensions;exports.getValidationResults=r.getValidationResults;exports.initPluginManager=r.initPluginManager;exports.initializeKosPlugins=r.initializeKosPlugins;exports.loadExtensions=r.loadExtensions;exports.registry=r.registry;exports.resolveBestExtension=r.resolveBestExtension;exports.validateDescriptorFormat=r.validateDescriptorFormat;exports.validateRank=r.validateRank;exports.validateRankIfPresent=r.validateRankIfPresent;exports.validateWithSchema=r.validateWithSchema;exports.extensionPointId=m;exports.generatePluginConfiguration=h;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/utils/processors/process-kos-config.ts","../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-types.ts","../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-transforms.ts","../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/define-extension-point.ts"],"sourcesContent":["/* eslint-disable max-lines-per-function */\nimport type { Contributions } from \"../../../types/global\";\n\ninterface KosConfigView {\n id: string;\n title: string;\n component: string;\n location: string;\n}\n\ninterface KosPluginConfig {\n id: string;\n init?: boolean;\n contributes: Contributions;\n}\n\ninterface DDKConfig {\n name: string;\n kosdev: {\n ddk: {\n ncui: {\n plugin: KosPluginConfig;\n };\n };\n };\n}\n\ninterface CoreKosConfig {\n name: string;\n kos: {\n ui: {\n plugin: KosPluginConfig;\n };\n };\n}\n\nexport type KosConfig = DDKConfig | CoreKosConfig;\n\nfunction normalizeVersion(version: string): string {\n const match = version.match(/^(\\d+)\\.(\\d+)\\.\\d+(?:-\\S+)?$/);\n if (!match) {\n throw new Error(`Invalid version format: ${version}`);\n }\n const [_, major, minor] = match;\n return `${major}.${minor}.0`;\n}\n\nexport interface PluginOptions {\n sdkVersion?: string;\n ddkVersion?: string;\n pluginPath?: string;\n}\nexport function generatePluginConfiguration(\n config: KosConfig,\n options?: PluginOptions\n): any {\n if (options?.sdkVersion) {\n console.log(\"sdkVersion\", options.sdkVersion);\n }\n if (options?.ddkVersion) {\n console.log(\"ddkVersion\", options.ddkVersion);\n }\n const sdkVersion = normalizeVersion(options?.sdkVersion || \"0.2.0\");\n const ddkVersion = normalizeVersion(options?.ddkVersion || \"0.2.0\");\n\n console.log(`Using DDK version: ${ddkVersion}`);\n console.log(`Using SDK version: ${sdkVersion}`);\n const projectId = config?.name;\n if (!projectId) {\n throw new Error(\n \"KOS Configuration should be added. Project name not found in config\"\n );\n }\n const pluginPath = options?.pluginPath || \"kosdev.ddk.ncui.plugin\";\n const pluginObj = pluginPath\n .split(\".\")\n .reduce<KosPluginConfig>((obj, key) => {\n console.log(`Accessing key: ${key}`);\n return obj && obj[key] ? obj[key] : undefined;\n }, config as unknown as KosPluginConfig);\n\n const pluginId = pluginObj?.id;\n if (!pluginId) {\n throw new Error(\n \"KOS Configuration should be added. Plugin ID not found in config\"\n );\n }\n const mfConfig = Object.keys(pluginObj?.contributes?.views || {}).reduce(\n (acc, key) => {\n const views = pluginObj.contributes.views[key];\n\n views.forEach((view) => {\n acc[`./${view.component}`] = view.location;\n });\n return acc;\n },\n {}\n );\n\n Object.values(pluginObj?.contributes?.experiences || {}).forEach(\n (experience) => {\n mfConfig[`./${experience.component}`] = experience.location;\n }\n );\n\n if (pluginObj?.init) {\n mfConfig[\"./InitPlugin\"] = \"./src/app/init.ts\";\n }\n\n return {\n name: projectId,\n exposes: mfConfig,\n library: { type: \"var\", name: pluginId },\n additionalShared: [\n {\n libraryName: \"@kosdev-code/kos-ui-plugin\",\n sharedConfig: {\n singleton: true,\n eager: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n\n {\n libraryName: \"react-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ui-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-dispense-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n\n {\n libraryName: \"@kosdev-code/kos-freestyle-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-model-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-models\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-styles\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@emotion/styled\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"@emotion/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"reflect-metadata\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.2.2\",\n },\n },\n {\n libraryName: \"mobx\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.9.0\",\n },\n },\n\n {\n libraryName: \"loglevel\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^1.8.1\",\n },\n },\n {\n libraryName: \"robot3\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.4.0\",\n },\n },\n {\n libraryName: \"mobx-react-lite\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.4.3\",\n },\n },\n {\n libraryName: \"react-router-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.11.2\",\n },\n },\n {\n libraryName: \"date-fns\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.30.0\",\n },\n },\n {\n libraryName: \"@use-gesture/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^10.3.0\",\n },\n },\n {\n libraryName: \"@react-spring/web\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^9.7.3\",\n },\n },\n {\n libraryName: \"react-simple-keyboard\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.6.13\",\n },\n },\n {\n libraryName: \"expr-eval\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.0.2\",\n },\n },\n {\n libraryName: \"zod\",\n sharedConfig: {\n singleton: true,\n eager: true,\n strictVersion: false,\n requiredVersion: \"^3.25.0\",\n },\n },\n ],\n };\n}\n","/**\n * Core types and interfaces for extension point system\n */\n\n// React import removed - component creation happens at runtime via hooks\nimport type { z } from \"zod\";\nimport type {\n BasePluginExtension,\n PluginExtensionsType,\n ProcessedContributions,\n} from \"../../../types/plugins\";\n\n/**\n * Validation context for collecting validation issues\n */\nexport interface ValidationContext {\n addError(message: string): void;\n addWarning(message: string): void;\n addInfo(message: string): void;\n hasErrors(): boolean;\n hasIssues(): boolean;\n getIssues(): { type: \"error\" | \"warning\" | \"info\"; message: string }[];\n}\n\n/**\n * Context provided to transform functions\n */\nexport interface TransformContext {\n remote: string;\n sectionId: string;\n experiences?: Record<string, any>;\n contributions: ProcessedContributions;\n}\n\n/**\n * Schema field information for documentation\n */\nexport interface SchemaFieldInfo {\n name: string;\n description?: string;\n type?: string;\n required?: boolean;\n}\n\n/**\n * Configuration for defining a new extension point\n */\nexport interface ExtensionPointConfig<\n TData = any,\n TProcessed = TData,\n _TProps = any\n> {\n /**\n * Unique identifier for this extension point\n * Convention: \"ddk.{feature}\" or \"ddk.{feature}.{sub-feature}\"\n */\n id: string;\n\n /**\n * Optional display name for documentation/discovery\n */\n displayName?: string;\n\n /**\n * Optional description for documentation/discovery\n */\n description?: string;\n\n /**\n * The contribution key in the plugin descriptor\n * e.g., \"myFeature\" maps to contributes.myFeature in kosdev-plugin.json\n */\n contributionKey: string;\n\n /**\n * Optional related extension points\n * For example, a main extension might have .view and .definition variants\n */\n relatedPoints?: {\n view?: string;\n definition?: string;\n [key: string]: string | undefined;\n };\n\n /**\n * Transform function to process raw contribution data\n * Allows custom processing logic while maintaining type safety\n */\n transform?: (data: TData, context: TransformContext) => TProcessed;\n\n /**\n * Optional validation function\n * Use context.addError/addWarning/addInfo to collect validation issues\n * Return \"skip\" to skip processing this contribution\n */\n validate?: (data: TData, context: ValidationContext) => \"skip\" | void;\n\n /**\n * Whether this extension point uses view/experience pattern\n * Default: false\n */\n hasView?: boolean;\n\n /**\n * Whether contributions should be ranked\n * Default: false\n */\n isRankable?: boolean;\n\n /**\n * Optional Zod schema for runtime validation and documentation\n * Provides both type safety and field introspection for Plugin Explorer\n */\n schema?: z.ZodSchema<TData>;\n\n /**\n * Metadata for discovery/documentation\n */\n metadata?: {\n category?: string;\n tags?: string[];\n since?: string;\n deprecated?: boolean;\n replacedBy?: string;\n owner?: string;\n /**\n * The actual export name of this extension point in the code\n * Used for documentation generation to show correct import statements\n */\n exportName?: string;\n };\n}\n\n/**\n * Props for extension point components\n */\nexport interface ExtensionComponentProps {\n /** Specific module to load (optional) */\n module?: string;\n /** Fallback component when extension not found */\n fallback?: React.ReactNode;\n}\n\n/**\n * Result of defining an extension point\n */\nexport interface ExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> {\n /**\n * The extension point configuration\n */\n config: ExtensionPointConfig<TData, TProcessed, TProps>;\n\n /**\n * Extension point ID for use in components\n */\n id: string;\n\n /**\n * Helper to get typed extensions (for future use with hooks)\n */\n getExtensions?: (\n extensions: PluginExtensionsType\n ) => Record<string, BasePluginExtension & { data: TProcessed }>;\n\n /**\n * Registration status\n */\n isRegistered: boolean;\n\n /**\n * Method to register this extension point\n */\n register: () => void;\n\n // Component property removed - use useExtensionComponent hook or createExtensionComponent factory at runtime\n\n /**\n * Get schema field information for documentation purposes\n * Returns field info that can be safely displayed by Plugin Explorer\n */\n getSchemaFieldInfo?: () => SchemaFieldInfo[];\n}\n\n/**\n * Extension point with hasView: true, guarantees Component property\n */\nexport interface ViewExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> extends ExtensionPointDefinition<TData, TProcessed, TProps> {\n Component: React.ComponentType<ExtensionComponentProps & TProps>;\n}\n\n/**\n * Type-safe extension point ID helper\n * Ensures consistent naming and helps with refactoring\n */\nexport function extensionPointId(\n namespace: string,\n feature: string,\n ...subFeatures: string[]\n): string {\n const parts = [namespace, feature, ...subFeatures].filter(Boolean);\n return parts.join(\".\");\n}\n","/**\n * Transform utilities for extension points\n */\n\nimport type { TransformContext } from \"./extension-point-types\";\n\n/**\n * Generic transform helper for extension points that use the experience/view pattern\n * Handles mapping experience IDs to experience data and flattening component properties\n */\nexport function createViewAwareTransform<TData extends Record<string, any>>(\n options: {\n /**\n * Property name that contains the experience ID (default: \"experienceId\")\n */\n experienceIdProperty?: keyof TData;\n /**\n * Whether to flatten component properties to root level for useDynamicComponent compatibility (default: true)\n */\n flattenComponentProperties?: boolean;\n /**\n * Additional transform logic to apply after view mapping\n */\n customTransform?: (\n data: TData,\n view: any,\n context: TransformContext\n ) => any;\n } = {}\n) {\n const {\n experienceIdProperty = \"experienceId\",\n flattenComponentProperties = true,\n customTransform,\n } = options;\n\n return (data: TData, context: TransformContext) => {\n // Map experience ID to experience data\n const experienceId = data[experienceIdProperty] as string;\n const view = experienceId ? context.experiences?.[experienceId] || {} : {};\n\n // Start with base data - use any to allow dynamic property addition\n let result: any = {\n ...data,\n view: view,\n };\n\n // Flatten component properties for useDynamicComponent compatibility\n if (flattenComponentProperties && view) {\n if (view.component) {\n result.component = view.component;\n }\n if (view.location) {\n result.location = view.location;\n }\n }\n\n // Apply custom transform if provided\n if (customTransform) {\n result = customTransform(data, view, context) || result;\n }\n\n return result;\n };\n}\n","/**\n * Simplified Extension Point Definition API\n *\n * This utility provides a streamlined way to define new extension points\n * without modifying multiple files. It maintains full backward compatibility\n * with existing extension points which continue to use the legacy reducer system.\n */\n\nimport type {\n ExtensionPointConfig,\n ExtensionPointDefinition,\n ViewExtensionPointDefinition,\n} from \"./extension-point-types\";\nimport { registry } from \"./extension-point-registry\";\n\n// Re-export types and interfaces\nexport type {\n ValidationContext,\n TransformContext,\n SchemaFieldInfo,\n ExtensionPointConfig,\n ExtensionComponentProps,\n ExtensionPointDefinition,\n ViewExtensionPointDefinition,\n} from \"./extension-point-types\";\n\n// Re-export utilities\nexport { extensionPointId } from \"./extension-point-types\";\nexport { createViewAwareTransform } from \"./extension-point-transforms\";\nexport {\n getExtensionPointRegistry,\n registry,\n} from \"./extension-point-registry\";\nexport { getValidationResults } from \"./extension-point-validation\";\n\n/**\n * Define a new extension point with simplified API\n *\n * Returns an extension point definition that must be explicitly registered\n * by calling the register() method. This prevents automatic registration\n * and circular dependency issues.\n *\n * @example\n * ```typescript\n * // Simple extension point\n * export const MyFeatureExtension = defineExtensionPoint({\n * id: 'ddk.myFeature',\n * contributionKey: 'myFeature',\n * displayName: 'My Feature',\n * description: 'Extension point for custom features'\n * });\n *\n * // Register it explicitly in your app initialization\n * MyFeatureExtension.register();\n *\n * // Extension point with view support\n * export const MyViewExtension = defineExtensionPoint({\n * id: 'ddk.myView.config',\n * contributionKey: 'myView',\n * hasView: true,\n * relatedPoints: {\n * view: 'ddk.myView.view',\n * definition: 'ddk.myView'\n * },\n * transform: (data, context) => ({\n * ...data,\n * processedAt: Date.now()\n * })\n * });\n *\n * // Register it explicitly in your app initialization\n * MyViewExtension.register();\n *\n * // Use the pre-configured component (for view-based extensions)\n * <MyViewExtension.Component\n * module=\"specific-module-id\"\n * fallback={<div>Loading...</div>}\n * customProp=\"value\"\n * />\n * ```\n */\n\n// Overload for hasView: true - guarantees Component property exists\nexport function defineExtensionPoint<\n TData = any,\n TProcessed = TData,\n TProps = any\n>(\n config: ExtensionPointConfig<TData, TProcessed, TProps> & { hasView: true }\n): ViewExtensionPointDefinition<TData, TProcessed, TProps>;\n\n// Overload for hasView: false/undefined - Component might not exist\nexport function defineExtensionPoint<\n TData = any,\n TProcessed = TData,\n TProps = any\n>(\n config: ExtensionPointConfig<TData, TProcessed, TProps>\n): ExtensionPointDefinition<TData, TProcessed, TProps>;\n\n// Implementation\nexport function defineExtensionPoint<\n TData = any,\n TProcessed = TData,\n TProps = any\n>(\n config: ExtensionPointConfig<TData, TProcessed, TProps>\n): ExtensionPointDefinition<TData, TProcessed, TProps> {\n return registry.define(config);\n}\n"],"names":["normalizeVersion","version","match","_","major","minor","generatePluginConfiguration","config","options","sdkVersion","ddkVersion","projectId","pluginObj","obj","key","pluginId","mfConfig","_a","acc","view","_b","experience","extensionPointId","namespace","feature","subFeatures","createViewAwareTransform","experienceIdProperty","flattenComponentProperties","customTransform","data","context","experienceId","result","defineExtensionPoint","registry"],"mappings":"yJAsCA,SAASA,EAAiBC,EAAyB,CACjD,MAAMC,EAAQD,EAAQ,MAAM,8BAA8B,EAC1D,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,2BAA2BD,CAAO,EAAE,EAEtD,KAAM,CAACE,EAAGC,EAAOC,CAAK,EAAIH,EAC1B,MAAO,GAAGE,CAAK,IAAIC,CAAK,IAC1B,CAOO,SAASC,EACdC,EACAC,EACK,SACDA,GAAA,MAAAA,EAAS,YACX,QAAQ,IAAI,aAAcA,EAAQ,UAAU,EAE1CA,GAAA,MAAAA,EAAS,YACX,QAAQ,IAAI,aAAcA,EAAQ,UAAU,EAE9C,MAAMC,EAAaT,GAAiBQ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B,OAEjD,MAAMC,EAAeF,EAAKH,CAAoB,EACxCR,EAAOa,IAAef,EAAAc,EAAQ,cAAR,YAAAd,EAAsBe,KAAiB,CAAA,EAAK,CAAA,EAGxE,IAAIC,EAAc,CAChB,GAAGH,EACH,KAAAX,CAAA,EAIF,OAAIS,GAA8BT,IAC5BA,EAAK,YACPc,EAAO,UAAYd,EAAK,WAEtBA,EAAK,WACPc,EAAO,SAAWd,EAAK,WAKvBU,IACFI,EAASJ,EAAgBC,EAAMX,EAAMY,CAAO,GAAKE,GAG5CA,CACT,CACF,CCqCO,SAASC,EAKd3B,EACqD,CACrD,OAAO4B,EAAAA,SAAS,OAAO5B,CAAM,CAC/B"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-types.ts","../../../../packages/sdk/kos-ui-plugin/src/lib/utils/processors/process-kos-config.ts"],"sourcesContent":["/**\n * Core types and interfaces for extension point system\n */\n\n// React import removed - component creation happens at runtime via hooks\nimport type { z } from \"zod\";\nimport type {\n BasePluginExtension,\n PluginExtensionsType,\n ProcessedContributions,\n} from \"../../../types/plugins\";\n\n/**\n * Validation context for collecting validation issues\n */\nexport interface ValidationContext {\n addError(message: string): void;\n addWarning(message: string): void;\n addInfo(message: string): void;\n hasErrors(): boolean;\n hasIssues(): boolean;\n getIssues(): { type: \"error\" | \"warning\" | \"info\"; message: string }[];\n}\n\n/**\n * Context provided to transform functions\n */\nexport interface TransformContext {\n remote: string;\n sectionId: string;\n experiences?: Record<string, any>;\n contributions: ProcessedContributions;\n}\n\n/**\n * Schema field information for documentation\n */\nexport interface SchemaFieldInfo {\n name: string;\n description?: string;\n type?: string;\n required?: boolean;\n}\n\n/**\n * Configuration for defining a new extension point\n */\nexport interface ExtensionPointConfig<\n TData = any,\n TProcessed = TData,\n _TProps = any\n> {\n /**\n * Unique identifier for this extension point\n * Convention: \"ddk.{feature}\" or \"ddk.{feature}.{sub-feature}\"\n */\n id: string;\n\n /**\n * Optional display name for documentation/discovery\n */\n displayName?: string;\n\n /**\n * Optional description for documentation/discovery\n */\n description?: string;\n\n /**\n * The contribution key in the plugin descriptor\n * e.g., \"myFeature\" maps to contributes.myFeature in kosdev-plugin.json\n */\n contributionKey: string;\n\n /**\n * Optional related extension points\n * For example, a main extension might have .view and .definition variants\n */\n relatedPoints?: {\n view?: string;\n definition?: string;\n [key: string]: string | undefined;\n };\n\n /**\n * Transform function to process raw contribution data\n * Allows custom processing logic while maintaining type safety\n */\n transform?: (data: TData, context: TransformContext) => TProcessed;\n\n /**\n * Optional validation function\n * Use context.addError/addWarning/addInfo to collect validation issues\n * Return \"skip\" to skip processing this contribution\n */\n validate?: (data: TData, context: ValidationContext) => \"skip\" | void;\n\n /**\n * Whether this extension point uses view/experience pattern\n * Default: false\n */\n hasView?: boolean;\n\n /**\n * Whether contributions should be ranked\n * Default: false\n */\n isRankable?: boolean;\n\n /**\n * Optional Zod schema for runtime validation and documentation\n * Provides both type safety and field introspection for Plugin Explorer\n */\n schema?: z.ZodSchema<TData>;\n\n /**\n * Metadata for discovery/documentation\n */\n metadata?: {\n category?: string;\n tags?: string[];\n since?: string;\n deprecated?: boolean;\n replacedBy?: string;\n owner?: string;\n /**\n * The actual export name of this extension point in the code\n * Used for documentation generation to show correct import statements\n */\n exportName?: string;\n };\n}\n\n/**\n * Props for extension point components\n */\nexport interface ExtensionComponentProps {\n /** Specific module to load (optional) */\n module?: string;\n /** Fallback component when extension not found */\n fallback?: React.ReactNode;\n}\n\n/**\n * Result of defining an extension point\n */\nexport interface ExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> {\n /**\n * The extension point configuration\n */\n config: ExtensionPointConfig<TData, TProcessed, TProps>;\n\n /**\n * Extension point ID for use in components\n */\n id: string;\n\n /**\n * Helper to get typed extensions (for future use with hooks)\n */\n getExtensions?: (\n extensions: PluginExtensionsType\n ) => Record<string, BasePluginExtension & { data: TProcessed }>;\n\n /**\n * Registration status\n */\n isRegistered: boolean;\n\n /**\n * Method to register this extension point\n */\n register: () => void;\n\n // Component property removed - use useExtensionComponent hook or createExtensionComponent factory at runtime\n\n /**\n * Get schema field information for documentation purposes\n * Returns field info that can be safely displayed by Plugin Explorer\n */\n getSchemaFieldInfo?: () => SchemaFieldInfo[];\n}\n\n/**\n * Extension point with hasView: true, guarantees Component property\n */\nexport interface ViewExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> extends ExtensionPointDefinition<TData, TProcessed, TProps> {\n Component: React.ComponentType<ExtensionComponentProps & TProps>;\n}\n\n/**\n * Type-safe extension point ID helper\n * Ensures consistent naming and helps with refactoring\n */\nexport function extensionPointId(\n namespace: string,\n feature: string,\n ...subFeatures: string[]\n): string {\n const parts = [namespace, feature, ...subFeatures].filter(Boolean);\n return parts.join(\".\");\n}\n","/* eslint-disable max-lines-per-function */\nimport type { Contributions } from \"../../../types/global\";\n\ninterface KosConfigView {\n id: string;\n title: string;\n component: string;\n location: string;\n}\n\ninterface KosPluginConfig {\n id: string;\n init?: boolean;\n contributes: Contributions;\n}\n\ninterface DDKConfig {\n name: string;\n kosdev: {\n ddk: {\n ncui: {\n plugin: KosPluginConfig;\n };\n };\n };\n}\n\ninterface CoreKosConfig {\n name: string;\n kos: {\n ui: {\n plugin: KosPluginConfig;\n };\n };\n}\n\nexport type KosConfig = DDKConfig | CoreKosConfig;\n\nfunction normalizeVersion(version: string): string {\n const match = version.match(/^(\\d+)\\.(\\d+)\\.\\d+(?:-\\S+)?$/);\n if (!match) {\n throw new Error(`Invalid version format: ${version}`);\n }\n const [_, major, minor] = match;\n return `${major}.${minor}.0`;\n}\n\nexport interface PluginOptions {\n sdkVersion?: string;\n ddkVersion?: string;\n pluginPath?: string;\n}\nexport function generatePluginConfiguration(\n config: KosConfig,\n options?: PluginOptions\n): any {\n if (options?.sdkVersion) {\n console.log(\"sdkVersion\", options.sdkVersion);\n }\n if (options?.ddkVersion) {\n console.log(\"ddkVersion\", options.ddkVersion);\n }\n const sdkVersion = normalizeVersion(options?.sdkVersion || \"0.2.0\");\n const ddkVersion = normalizeVersion(options?.ddkVersion || \"0.2.0\");\n\n console.log(`Using DDK version: ${ddkVersion}`);\n console.log(`Using SDK version: ${sdkVersion}`);\n const projectId = config?.name;\n if (!projectId) {\n throw new Error(\n \"KOS Configuration should be added. Project name not found in config\"\n );\n }\n const pluginPath = options?.pluginPath || \"kosdev.ddk.ncui.plugin\";\n const pluginObj = pluginPath\n .split(\".\")\n .reduce<KosPluginConfig>((obj, key) => {\n console.log(`Accessing key: ${key}`);\n return obj && obj[key] ? obj[key] : undefined;\n }, config as unknown as KosPluginConfig);\n\n const pluginId = pluginObj?.id;\n if (!pluginId) {\n throw new Error(\n \"KOS Configuration should be added. Plugin ID not found in config\"\n );\n }\n const mfConfig = Object.keys(pluginObj?.contributes?.views || {}).reduce(\n (acc, key) => {\n const views = pluginObj.contributes.views[key];\n\n views.forEach((view) => {\n acc[`./${view.component}`] = view.location;\n });\n return acc;\n },\n {}\n );\n\n Object.values(pluginObj?.contributes?.experiences || {}).forEach(\n (experience) => {\n mfConfig[`./${experience.component}`] = experience.location;\n }\n );\n\n if (pluginObj?.init) {\n mfConfig[\"./InitPlugin\"] = \"./src/app/init.ts\";\n }\n\n return {\n name: projectId,\n exposes: mfConfig,\n library: { type: \"var\", name: pluginId },\n additionalShared: [\n {\n libraryName: \"@kosdev-code/kos-ui-plugin\",\n sharedConfig: {\n singleton: true,\n eager: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n\n {\n libraryName: \"react-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ui-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-dispense-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n\n {\n libraryName: \"@kosdev-code/kos-freestyle-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-model-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-models\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-styles\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@emotion/styled\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"@emotion/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"reflect-metadata\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.2.2\",\n },\n },\n {\n libraryName: \"mobx\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.9.0\",\n },\n },\n\n {\n libraryName: \"loglevel\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^1.8.1\",\n },\n },\n {\n libraryName: \"robot3\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.4.0\",\n },\n },\n {\n libraryName: \"mobx-react-lite\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.4.3\",\n },\n },\n {\n libraryName: \"react-router-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.11.2\",\n },\n },\n {\n libraryName: \"date-fns\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.30.0\",\n },\n },\n {\n libraryName: \"@use-gesture/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^10.3.0\",\n },\n },\n {\n libraryName: \"@react-spring/web\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^9.7.3\",\n },\n },\n {\n libraryName: \"react-simple-keyboard\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.6.13\",\n },\n },\n {\n libraryName: \"expr-eval\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.0.2\",\n },\n },\n {\n libraryName: \"zod\",\n sharedConfig: {\n singleton: true,\n eager: true,\n strictVersion: false,\n requiredVersion: \"^3.25.0\",\n },\n },\n ],\n };\n}\n"],"names":["extensionPointId","namespace","feature","subFeatures","normalizeVersion","version","match","_","major","minor","generatePluginConfiguration","config","options","sdkVersion","ddkVersion","projectId","pluginObj","obj","key","pluginId","mfConfig","_a","acc","view","_b","experience"],"mappings":"yJA0MO,SAASA,EACdC,EACAC,KACGC,EACK,CAER,MADc,CAACF,EAAWC,EAAS,GAAGC,CAAW,EAAE,OAAO,OAAO,EACpD,KAAK,GAAG,CACvB,CC3KA,SAASC,EAAiBC,EAAyB,CACjD,MAAMC,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,EAEF,CACE,YAAa,MACb,aAAc,CACZ,UAAW,GACX,MAAO,GACP,cAAe,GACf,gBAAiB,SAAA,CACnB,CACF,CACF,CAEJ"}
|
package/utils.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { B as $, D as P, P as w, R as E, e as I, n as S, f as D, c as R, h as K, g as p, b as B, a as z, l as A, r as T, j as U, k as F, o as G, v as M } from "./documentation-generator-B8FuhDjB.js";
|
|
1
|
+
import { B as v, D as q, P as N, R as $, d as x, p as P, j as w, h as E, e as S, c as D, f as I, g as R, b as K, a as B, l as z, k as A, r as U, n as F, o as G, q as M, v as T } from "./documentation-generator-BVDETA08.js";
|
|
3
2
|
import "zod";
|
|
4
|
-
function
|
|
5
|
-
|
|
3
|
+
function k(i, e, ...n) {
|
|
4
|
+
return [i, e, ...n].filter(Boolean).join(".");
|
|
5
|
+
}
|
|
6
|
+
function u(i) {
|
|
7
|
+
const e = i.match(/^(\d+)\.(\d+)\.\d+(?:-\S+)?$/);
|
|
6
8
|
if (!e)
|
|
7
|
-
throw new Error(`Invalid version format: ${
|
|
8
|
-
const [
|
|
9
|
-
return `${
|
|
9
|
+
throw new Error(`Invalid version format: ${i}`);
|
|
10
|
+
const [n, s, t] = e;
|
|
11
|
+
return `${s}.${t}.0`;
|
|
10
12
|
}
|
|
11
|
-
function
|
|
12
|
-
var
|
|
13
|
+
function y(i, e) {
|
|
14
|
+
var g, f;
|
|
13
15
|
e != null && e.sdkVersion && console.log("sdkVersion", e.sdkVersion), e != null && e.ddkVersion && console.log("ddkVersion", e.ddkVersion);
|
|
14
|
-
const
|
|
15
|
-
console.log(`Using DDK version: ${
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
16
|
+
const n = u((e == null ? void 0 : e.sdkVersion) || "0.2.0"), s = u((e == null ? void 0 : e.ddkVersion) || "0.2.0");
|
|
17
|
+
console.log(`Using DDK version: ${s}`), console.log(`Using SDK version: ${n}`);
|
|
18
|
+
const t = i == null ? void 0 : i.name;
|
|
19
|
+
if (!t)
|
|
18
20
|
throw new Error(
|
|
19
21
|
"KOS Configuration should be added. Project name not found in config"
|
|
20
22
|
);
|
|
21
|
-
const r = ((e == null ? void 0 : e.pluginPath) || "kosdev.ddk.ncui.plugin").split(".").reduce((
|
|
22
|
-
if (!
|
|
23
|
+
const r = ((e == null ? void 0 : e.pluginPath) || "kosdev.ddk.ncui.plugin").split(".").reduce((a, o) => (console.log(`Accessing key: ${o}`), a && a[o] ? a[o] : void 0), i), d = r == null ? void 0 : r.id;
|
|
24
|
+
if (!d)
|
|
23
25
|
throw new Error(
|
|
24
26
|
"KOS Configuration should be added. Plugin ID not found in config"
|
|
25
27
|
);
|
|
26
|
-
const
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
}),
|
|
28
|
+
const l = Object.keys(((g = r == null ? void 0 : r.contributes) == null ? void 0 : g.views) || {}).reduce(
|
|
29
|
+
(a, o) => (r.contributes.views[o].forEach((c) => {
|
|
30
|
+
a[`./${c.component}`] = c.location;
|
|
31
|
+
}), a),
|
|
30
32
|
{}
|
|
31
33
|
);
|
|
32
|
-
return Object.values(((
|
|
33
|
-
(
|
|
34
|
-
|
|
34
|
+
return Object.values(((f = r == null ? void 0 : r.contributes) == null ? void 0 : f.experiences) || {}).forEach(
|
|
35
|
+
(a) => {
|
|
36
|
+
l[`./${a.component}`] = a.location;
|
|
35
37
|
}
|
|
36
|
-
), r != null && r.init && (
|
|
37
|
-
name:
|
|
38
|
-
exposes:
|
|
39
|
-
library: { type: "var", name:
|
|
38
|
+
), r != null && r.init && (l["./InitPlugin"] = "./src/app/init.ts"), {
|
|
39
|
+
name: t,
|
|
40
|
+
exposes: l,
|
|
41
|
+
library: { type: "var", name: d },
|
|
40
42
|
additionalShared: [
|
|
41
43
|
{
|
|
42
44
|
libraryName: "@kosdev-code/kos-ui-plugin",
|
|
43
45
|
sharedConfig: {
|
|
44
46
|
singleton: !0,
|
|
45
47
|
eager: !1,
|
|
46
|
-
requiredVersion: `~${
|
|
48
|
+
requiredVersion: `~${s}`
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
{
|
|
@@ -70,7 +72,7 @@ function b(s, e) {
|
|
|
70
72
|
singleton: !0,
|
|
71
73
|
eager: !1,
|
|
72
74
|
strictVersion: !1,
|
|
73
|
-
requiredVersion: `~${
|
|
75
|
+
requiredVersion: `~${n}`
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
78
|
{
|
|
@@ -79,7 +81,7 @@ function b(s, e) {
|
|
|
79
81
|
singleton: !0,
|
|
80
82
|
eager: !1,
|
|
81
83
|
strictVersion: !1,
|
|
82
|
-
requiredVersion: `~${
|
|
84
|
+
requiredVersion: `~${n}`
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
{
|
|
@@ -88,7 +90,7 @@ function b(s, e) {
|
|
|
88
90
|
singleton: !0,
|
|
89
91
|
eager: !1,
|
|
90
92
|
strictVersion: !1,
|
|
91
|
-
requiredVersion: `~${
|
|
93
|
+
requiredVersion: `~${n}`
|
|
92
94
|
}
|
|
93
95
|
},
|
|
94
96
|
{
|
|
@@ -97,7 +99,7 @@ function b(s, e) {
|
|
|
97
99
|
singleton: !0,
|
|
98
100
|
eager: !1,
|
|
99
101
|
strictVersion: !1,
|
|
100
|
-
requiredVersion: `~${
|
|
102
|
+
requiredVersion: `~${s}`
|
|
101
103
|
}
|
|
102
104
|
},
|
|
103
105
|
{
|
|
@@ -106,7 +108,7 @@ function b(s, e) {
|
|
|
106
108
|
singleton: !0,
|
|
107
109
|
eager: !1,
|
|
108
110
|
strictVersion: !1,
|
|
109
|
-
requiredVersion: `~${
|
|
111
|
+
requiredVersion: `~${s}`
|
|
110
112
|
}
|
|
111
113
|
},
|
|
112
114
|
{
|
|
@@ -115,7 +117,7 @@ function b(s, e) {
|
|
|
115
117
|
singleton: !0,
|
|
116
118
|
eager: !1,
|
|
117
119
|
strictVersion: !1,
|
|
118
|
-
requiredVersion: `~${
|
|
120
|
+
requiredVersion: `~${s}`
|
|
119
121
|
}
|
|
120
122
|
},
|
|
121
123
|
{
|
|
@@ -124,7 +126,7 @@ function b(s, e) {
|
|
|
124
126
|
singleton: !0,
|
|
125
127
|
eager: !1,
|
|
126
128
|
strictVersion: !1,
|
|
127
|
-
requiredVersion: `~${
|
|
129
|
+
requiredVersion: `~${s}`
|
|
128
130
|
}
|
|
129
131
|
},
|
|
130
132
|
{
|
|
@@ -133,7 +135,7 @@ function b(s, e) {
|
|
|
133
135
|
singleton: !0,
|
|
134
136
|
eager: !1,
|
|
135
137
|
strictVersion: !1,
|
|
136
|
-
requiredVersion: `~${
|
|
138
|
+
requiredVersion: `~${s}`
|
|
137
139
|
}
|
|
138
140
|
},
|
|
139
141
|
{
|
|
@@ -265,51 +267,29 @@ function b(s, e) {
|
|
|
265
267
|
]
|
|
266
268
|
};
|
|
267
269
|
}
|
|
268
|
-
function C(s, e, ...a) {
|
|
269
|
-
return [s, e, ...a].filter(Boolean).join(".");
|
|
270
|
-
}
|
|
271
|
-
function v(s = {}) {
|
|
272
|
-
const {
|
|
273
|
-
experienceIdProperty: e = "experienceId",
|
|
274
|
-
flattenComponentProperties: a = !0,
|
|
275
|
-
customTransform: i
|
|
276
|
-
} = s;
|
|
277
|
-
return (l, f) => {
|
|
278
|
-
var d;
|
|
279
|
-
const r = l[e], n = r ? ((d = f.experiences) == null ? void 0 : d[r]) || {} : {};
|
|
280
|
-
let o = {
|
|
281
|
-
...l,
|
|
282
|
-
view: n
|
|
283
|
-
};
|
|
284
|
-
return a && n && (n.component && (o.component = n.component), n.location && (o.location = n.location)), i && (o = i(l, n, f) || o), o;
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function q(s) {
|
|
288
|
-
return V.define(s);
|
|
289
|
-
}
|
|
290
270
|
export {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
271
|
+
v as BaseViewExtensionSchema,
|
|
272
|
+
q as DocumentationGenerator,
|
|
273
|
+
N as PluginDiscoveryService,
|
|
274
|
+
$ as RankableViewExtensionSchema,
|
|
275
|
+
x as contributionReducer,
|
|
276
|
+
P as createExtensionSchema,
|
|
277
|
+
w as createViewAwareTransform,
|
|
278
|
+
E as defineExtensionPoint,
|
|
279
|
+
k as extensionPointId,
|
|
280
|
+
y as generatePluginConfiguration,
|
|
281
|
+
S as getContributions,
|
|
282
|
+
D as getExtensionPointRegistry,
|
|
283
|
+
I as getExtensions,
|
|
284
|
+
R as getValidationResults,
|
|
285
|
+
K as initPluginManager,
|
|
286
|
+
B as initializeKosPlugins,
|
|
287
|
+
z as loadExtensions,
|
|
288
|
+
A as registry,
|
|
289
|
+
U as resolveBestExtension,
|
|
290
|
+
F as validateDescriptorFormat,
|
|
291
|
+
G as validateRank,
|
|
292
|
+
M as validateRankIfPresent,
|
|
293
|
+
T as validateWithSchema
|
|
314
294
|
};
|
|
315
295
|
//# sourceMappingURL=utils.js.map
|