@ui5/mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/LICENSE +201 -0
- package/LICENSES/Apache-2.0.txt +73 -0
- package/README.md +131 -0
- package/bin/ui5mcp.js +2 -0
- package/lib/Context.d.ts +28 -0
- package/lib/Context.js +71 -0
- package/lib/Context.js.map +1 -0
- package/lib/api.d.ts +3 -0
- package/lib/api.js +3 -0
- package/lib/api.js.map +1 -0
- package/lib/cli.d.ts +1 -0
- package/lib/cli.js +12 -0
- package/lib/cli.js.map +1 -0
- package/lib/registerTools.d.ts +133 -0
- package/lib/registerTools.js +59 -0
- package/lib/registerTools.js.map +1 -0
- package/lib/resources/documentation/getDocumentation.d.ts +18 -0
- package/lib/resources/documentation/getDocumentation.js +70 -0
- package/lib/resources/documentation/getDocumentation.js.map +1 -0
- package/lib/server.d.ts +10 -0
- package/lib/server.js +113 -0
- package/lib/server.js.map +1 -0
- package/lib/tools/create_ui5_app/ODataMetadata.d.ts +55 -0
- package/lib/tools/create_ui5_app/ODataMetadata.js +99 -0
- package/lib/tools/create_ui5_app/ODataMetadata.js.map +1 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.d.ts +13 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.js +45 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.js.map +1 -0
- package/lib/tools/create_ui5_app/create_ui5_app.d.ts +8 -0
- package/lib/tools/create_ui5_app/create_ui5_app.js +273 -0
- package/lib/tools/create_ui5_app/create_ui5_app.js.map +1 -0
- package/lib/tools/create_ui5_app/index.d.ts +3 -0
- package/lib/tools/create_ui5_app/index.js +58 -0
- package/lib/tools/create_ui5_app/index.js.map +1 -0
- package/lib/tools/create_ui5_app/isValidUrl.d.ts +16 -0
- package/lib/tools/create_ui5_app/isValidUrl.js +59 -0
- package/lib/tools/create_ui5_app/isValidUrl.js.map +1 -0
- package/lib/tools/create_ui5_app/schema.d.ts +135 -0
- package/lib/tools/create_ui5_app/schema.js +67 -0
- package/lib/tools/create_ui5_app/schema.js.map +1 -0
- package/lib/tools/create_ui5_app/templateProcessor.d.ts +67 -0
- package/lib/tools/create_ui5_app/templateProcessor.js +59 -0
- package/lib/tools/create_ui5_app/templateProcessor.js.map +1 -0
- package/lib/tools/create_ui5_app/ui5Version.d.ts +2 -0
- package/lib/tools/create_ui5_app/ui5Version.js +6 -0
- package/lib/tools/create_ui5_app/ui5Version.js.map +1 -0
- package/lib/tools/get_api_reference/createUriForSymbol.d.ts +2 -0
- package/lib/tools/get_api_reference/createUriForSymbol.js +49 -0
- package/lib/tools/get_api_reference/createUriForSymbol.js.map +1 -0
- package/lib/tools/get_api_reference/getApiReference.d.ts +10 -0
- package/lib/tools/get_api_reference/getApiReference.js +51 -0
- package/lib/tools/get_api_reference/getApiReference.js.map +1 -0
- package/lib/tools/get_api_reference/index.d.ts +3 -0
- package/lib/tools/get_api_reference/index.js +38 -0
- package/lib/tools/get_api_reference/index.js.map +1 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.d.ts +85 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js +452 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js.map +1 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.d.ts +18 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.js +138 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.js.map +1 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.d.ts +24 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.js +109 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.js.map +1 -0
- package/lib/tools/get_api_reference/schema.d.ts +16 -0
- package/lib/tools/get_api_reference/schema.js +12 -0
- package/lib/tools/get_api_reference/schema.js.map +1 -0
- package/lib/tools/get_guidelines/guidelines.d.ts +1 -0
- package/lib/tools/get_guidelines/guidelines.js +6 -0
- package/lib/tools/get_guidelines/guidelines.js.map +1 -0
- package/lib/tools/get_guidelines/index.d.ts +3 -0
- package/lib/tools/get_guidelines/index.js +30 -0
- package/lib/tools/get_guidelines/index.js.map +1 -0
- package/lib/tools/get_project_info/getProjectInfo.d.ts +2 -0
- package/lib/tools/get_project_info/getProjectInfo.js +205 -0
- package/lib/tools/get_project_info/getProjectInfo.js.map +1 -0
- package/lib/tools/get_project_info/index.d.ts +3 -0
- package/lib/tools/get_project_info/index.js +28 -0
- package/lib/tools/get_project_info/index.js.map +1 -0
- package/lib/tools/get_project_info/schema.d.ts +87 -0
- package/lib/tools/get_project_info/schema.js +28 -0
- package/lib/tools/get_project_info/schema.js.map +1 -0
- package/lib/tools/get_version_info/getVersionInfo.d.ts +8 -0
- package/lib/tools/get_version_info/getVersionInfo.js +41 -0
- package/lib/tools/get_version_info/getVersionInfo.js.map +1 -0
- package/lib/tools/get_version_info/index.d.ts +9 -0
- package/lib/tools/get_version_info/index.js +33 -0
- package/lib/tools/get_version_info/index.js.map +1 -0
- package/lib/tools/get_version_info/schema.d.ts +66 -0
- package/lib/tools/get_version_info/schema.js +16 -0
- package/lib/tools/get_version_info/schema.js.map +1 -0
- package/lib/tools/get_version_info/types.d.ts +5 -0
- package/lib/tools/get_version_info/types.js +2 -0
- package/lib/tools/get_version_info/types.js.map +1 -0
- package/lib/tools/run_ui5_linter/index.d.ts +3 -0
- package/lib/tools/run_ui5_linter/index.js +86 -0
- package/lib/tools/run_ui5_linter/index.js.map +1 -0
- package/lib/tools/run_ui5_linter/migrationGuides.d.ts +6 -0
- package/lib/tools/run_ui5_linter/migrationGuides.js +88 -0
- package/lib/tools/run_ui5_linter/migrationGuides.js.map +1 -0
- package/lib/tools/run_ui5_linter/resultContext.d.ts +3 -0
- package/lib/tools/run_ui5_linter/resultContext.js +236 -0
- package/lib/tools/run_ui5_linter/resultContext.js.map +1 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.d.ts +2 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.js +72 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.js.map +1 -0
- package/lib/tools/run_ui5_linter/schema.d.ts +340 -0
- package/lib/tools/run_ui5_linter/schema.js +55 -0
- package/lib/tools/run_ui5_linter/schema.js.map +1 -0
- package/lib/utils/cdnHelper.d.ts +9 -0
- package/lib/utils/cdnHelper.js +50 -0
- package/lib/utils/cdnHelper.js.map +1 -0
- package/lib/utils/dataStorageHelper.d.ts +2 -0
- package/lib/utils/dataStorageHelper.js +65 -0
- package/lib/utils/dataStorageHelper.js.map +1 -0
- package/lib/utils/ui5Framework.d.ts +4 -0
- package/lib/utils/ui5Framework.js +6 -0
- package/lib/utils/ui5Framework.js.map +1 -0
- package/lib/utils.d.ts +10 -0
- package/lib/utils.js +87 -0
- package/lib/utils.js.map +1 -0
- package/npm-shrinkwrap.json +7880 -0
- package/package.json +121 -0
- package/resources/docs/1.136.7/00737d6c1b864dc3ab72ef56611491c4.md +155 -0
- package/resources/docs/1.136.7/0187ea5e2eff4166b0453b9dcc8fc64f.md +164 -0
- package/resources/docs/1.136.7/032be2cb2e1d4115af20862673bedcdb.md +12 -0
- package/resources/docs/1.136.7/28fcd55b04654977b63dacbee0552712.md +317 -0
- package/resources/docs/1.136.7/676b636446c94eada183b1218a824717.md +135 -0
- package/resources/docs/1.136.7/a87ca843bcee469f82a9072927a7dcdb.md +355 -0
- package/resources/docs/1.136.7/b0fb4de7364f4bcbb053a99aa645affe.md +126 -0
- package/resources/docs/1.136.7/fe1a6dba940e479fb7c3bc753f92b28c.md +670 -0
- package/resources/docs/1.136.7/index.json +58 -0
- package/resources/guidelines.md +104 -0
- package/resources/migrationGuides/deprecated-controller-factory.md +116 -0
- package/resources/migrationGuides/deprecated-getLibraryResourceBundle.md +62 -0
- package/resources/migrationGuides/deprecated-jquery-sap-require.md +141 -0
- package/resources/migrationGuides/deprecated-messagePage.md +162 -0
- package/resources/migrationGuides/deprecated-table-table-property.md +154 -0
- package/resources/template-js/LICENSE +201 -0
- package/resources/template-js/README.md +87 -0
- package/resources/template-js/_.editorconfig +22 -0
- package/resources/template-js/_.gitignore +17 -0
- package/resources/template-js/eslint.config.js +68 -0
- package/resources/template-js/karma-ci-cov.conf.js +20 -0
- package/resources/template-js/karma-ci.conf.js +9 -0
- package/resources/template-js/karma.conf.js +9 -0
- package/resources/template-js/package.json +34 -0
- package/resources/template-js/ui5-dist.yaml +18 -0
- package/resources/template-js/ui5.yaml +24 -0
- package/resources/template-js/webapp/Component.js +41 -0
- package/resources/template-js/webapp/controller/App.controller.js +10 -0
- package/resources/template-js/webapp/controller/BaseController.js +67 -0
- package/resources/template-js/webapp/controller/Main.controller.js +14 -0
- package/resources/template-js/webapp/i18n/i18n.properties +3 -0
- package/resources/template-js/webapp/i18n/i18n_en.properties +3 -0
- package/resources/template-js/webapp/index-cdn.html +34 -0
- package/resources/template-js/webapp/index.html +34 -0
- package/resources/template-js/webapp/manifest.json +103 -0
- package/resources/template-js/webapp/model/formatter.js +9 -0
- package/resources/template-js/webapp/model/models.js +11 -0
- package/resources/template-js/webapp/test/Test.qunit.html +16 -0
- package/resources/template-js/webapp/test/integration/HelloJourney.js +85 -0
- package/resources/template-js/webapp/test/integration/opaTests.qunit.js +1 -0
- package/resources/template-js/webapp/test/integration/pages/Main.js +112 -0
- package/resources/template-js/webapp/test/testsuite.qunit.html +18 -0
- package/resources/template-js/webapp/test/testsuite.qunit.js +37 -0
- package/resources/template-js/webapp/test/unit/controller/Main.qunit.js +11 -0
- package/resources/template-js/webapp/test/unit/unitTests.qunit.js +1 -0
- package/resources/template-js/webapp/test-lt1_124/integration/HelloJourney.js +85 -0
- package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.html +31 -0
- package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.js +11 -0
- package/resources/template-js/webapp/test-lt1_124/integration/pages/Main.js +112 -0
- package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.html +13 -0
- package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.js +9 -0
- package/resources/template-js/webapp/test-lt1_124/unit/controller/Main.qunit.js +11 -0
- package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.html +30 -0
- package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.js +12 -0
- package/resources/template-js/webapp/view/App.view.xml +9 -0
- package/resources/template-js/webapp/view/Main.view.xml +90 -0
- package/resources/template-ts/LICENSE +201 -0
- package/resources/template-ts/README.md +101 -0
- package/resources/template-ts/_.editorconfig +23 -0
- package/resources/template-ts/_.gitignore +18 -0
- package/resources/template-ts/_.nycrc.json +7 -0
- package/resources/template-ts/_tsconfig.json +21 -0
- package/resources/template-ts/eslint.config.mjs +27 -0
- package/resources/template-ts/package.json +40 -0
- package/resources/template-ts/ui5-coverage.yaml +40 -0
- package/resources/template-ts/ui5-dist.yaml +18 -0
- package/resources/template-ts/ui5.yaml +27 -0
- package/resources/template-ts/webapp/Component.ts +49 -0
- package/resources/template-ts/webapp/controller/App.controller.ts +11 -0
- package/resources/template-ts/webapp/controller/BaseController.ts +83 -0
- package/resources/template-ts/webapp/controller/Main.controller.ts +19 -0
- package/resources/template-ts/webapp/i18n/i18n.properties +3 -0
- package/resources/template-ts/webapp/i18n/i18n_en.properties +3 -0
- package/resources/template-ts/webapp/index-cdn.html +35 -0
- package/resources/template-ts/webapp/index.html +35 -0
- package/resources/template-ts/webapp/manifest.json +105 -0
- package/resources/template-ts/webapp/model/formatter.ts +5 -0
- package/resources/template-ts/webapp/model/models.ts +15 -0
- package/resources/template-ts/webapp/test/Test.qunit.html +16 -0
- package/resources/template-ts/webapp/test/integration/HelloJourney.ts +84 -0
- package/resources/template-ts/webapp/test/integration/opaTests.qunit.ts +2 -0
- package/resources/template-ts/webapp/test/integration/pages/MainPage.ts +112 -0
- package/resources/template-ts/webapp/test/testsuite.qunit.html +18 -0
- package/resources/template-ts/webapp/test/testsuite.qunit.ts +33 -0
- package/resources/template-ts/webapp/test/unit/controller/Main.qunit.ts +8 -0
- package/resources/template-ts/webapp/test/unit/unitTests.qunit.ts +2 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/HelloJourney.ts +86 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.html +34 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.ts +8 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/pages/MainPage.ts +112 -0
- package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.html +13 -0
- package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.ts +9 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/controller/Main.qunit.ts +8 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.html +37 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.ts +8 -0
- package/resources/template-ts/webapp/view/App.view.xml +9 -0
- package/resources/template-ts/webapp/view/Main.view.xml +90 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/create_ui5_app/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAe,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE7E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;SACtB,KAAK,CAAC,uBAAuB,EAAE,EAAC,OAAO,EAAE,iEAAiE,EAAC,CAAC;SAC5G,QAAQ,CAAC,2DAA2D;QACpE,4EAA4E,CAAC;IAC/E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,6EAA6E;QACtF,yEAAyE;QACzE,2EAA2E;QAC3E,2EAA2E,CAAC;IAC9E,sGAAsG;IACtG,oCAAoC;IACpC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;SACtD,QAAQ,CAAC,2EAA2E;QACpF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AAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;SAC3D,QAAQ,CAAC,0EAA0E,CAAC;IACtF,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;SACjD,QAAQ,CAAC,uEAAuE,CAAC;IACnF,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;SAC9C,QAAQ,CAAC,sFAAsF;QAC/F,iFAAiF;QACjF,oGAAoG;QACpG,+FAA+F,CAAC;CAClG,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Ui5Framework } from "../../utils/ui5Framework.js";
|
|
2
|
+
/**
|
|
3
|
+
* Template variable definitions for EJS templates.
|
|
4
|
+
*/
|
|
5
|
+
export interface TemplateVars {
|
|
6
|
+
/** Namespace for the application */
|
|
7
|
+
namespace: string;
|
|
8
|
+
/** Framework used, either OpenUI5 or SAPUI5 */
|
|
9
|
+
framework: Ui5Framework;
|
|
10
|
+
/** Version of the framework */
|
|
11
|
+
frameworkVersion: string;
|
|
12
|
+
/** Author of the application */
|
|
13
|
+
author: string;
|
|
14
|
+
/** TypeScript types npm package (only in TS case) */
|
|
15
|
+
tstypes?: string;
|
|
16
|
+
/** Version of TypeScript types npm package (only in TS case) */
|
|
17
|
+
tstypesVersion?: string;
|
|
18
|
+
/** Application ID */
|
|
19
|
+
appId: string;
|
|
20
|
+
/** Application URI (ID with slashes instead of dots) */
|
|
21
|
+
appURI: string;
|
|
22
|
+
/** CDN domain for resources */
|
|
23
|
+
cdnDomain: string;
|
|
24
|
+
/** OData V4 service URL */
|
|
25
|
+
oDataV4Url?: string;
|
|
26
|
+
/** OData entity set name */
|
|
27
|
+
oDataEntitySet?: string;
|
|
28
|
+
/** Properties of the entity to display */
|
|
29
|
+
entityProperties?: string[];
|
|
30
|
+
/** Indicates if server requires X-CSRF token , for optimized model config */
|
|
31
|
+
serverRequiresXCSRF?: boolean;
|
|
32
|
+
/** Default theme for the application */
|
|
33
|
+
defaultTheme: string;
|
|
34
|
+
/** QUnit coverage file - depends on UI5 version */
|
|
35
|
+
qunitCoverageFile: string;
|
|
36
|
+
/** Flags for version-specific features */
|
|
37
|
+
gte1_98_0: boolean;
|
|
38
|
+
gte1_100_0: boolean;
|
|
39
|
+
gte1_104_0: boolean;
|
|
40
|
+
lt1_110_0: boolean;
|
|
41
|
+
gte1_115_0: boolean;
|
|
42
|
+
gte1_120_0: boolean;
|
|
43
|
+
lt1_124_0: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for processing EJS templates with UI5-specific version handling.
|
|
47
|
+
*/
|
|
48
|
+
export interface TemplateProcessingOptions {
|
|
49
|
+
/** Directory containing the template files */
|
|
50
|
+
templateDir: string;
|
|
51
|
+
/** Target directory where processed files should be written */
|
|
52
|
+
targetDir: string;
|
|
53
|
+
/** Variables to pass to EJS template rendering */
|
|
54
|
+
templateVars: TemplateVars;
|
|
55
|
+
/** Version-specific logic flags */
|
|
56
|
+
versionSpecificLogic?: {
|
|
57
|
+
lt1_124_0: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Processes EJS templates from a source directory to a target directory.
|
|
62
|
+
* Handles UI5-specific version logic for test folder structure.
|
|
63
|
+
*
|
|
64
|
+
* @param options - Configuration for template processing
|
|
65
|
+
* @throws Error if template processing fails
|
|
66
|
+
*/
|
|
67
|
+
export declare function processTemplates(options: TemplateProcessingOptions): Promise<string[]>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { globby } from "globby";
|
|
3
|
+
import ejs from "ejs";
|
|
4
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
5
|
+
/**
|
|
6
|
+
* Processes EJS templates from a source directory to a target directory.
|
|
7
|
+
* Handles UI5-specific version logic for test folder structure.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Configuration for template processing
|
|
10
|
+
* @throws Error if template processing fails
|
|
11
|
+
*/
|
|
12
|
+
export async function processTemplates(options) {
|
|
13
|
+
const { templateDir, targetDir, templateVars, versionSpecificLogic } = options;
|
|
14
|
+
// Paths must be POSIX, as globby always provides POSIX paths, even on Windows
|
|
15
|
+
const webappTestDir = "webapp/test/";
|
|
16
|
+
const webappTestDir_lt1_124 = "webapp/test-lt1_124/";
|
|
17
|
+
// Get all template files
|
|
18
|
+
const templateFiles = await globby("**", {
|
|
19
|
+
cwd: templateDir,
|
|
20
|
+
});
|
|
21
|
+
const generatedFiles = [];
|
|
22
|
+
for (const file of templateFiles) {
|
|
23
|
+
let targetFile = file;
|
|
24
|
+
// Handle version-specific test folder logic
|
|
25
|
+
if (versionSpecificLogic) {
|
|
26
|
+
if (file.startsWith(webappTestDir_lt1_124)) {
|
|
27
|
+
if (versionSpecificLogic.lt1_124_0) {
|
|
28
|
+
targetFile = file.replace(webappTestDir_lt1_124, webappTestDir);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
continue; // Skip this file
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (file.startsWith(webappTestDir) && versionSpecificLogic.lt1_124_0) {
|
|
35
|
+
continue; // Skip this file
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const sourcePath = path.join(templateDir, file);
|
|
39
|
+
const targetPath = path.join(targetDir, targetFile.replace(/^_/, "").replace(/\/_/, "/"));
|
|
40
|
+
// Ensure target directory exists
|
|
41
|
+
const targetDirPath = path.dirname(targetPath);
|
|
42
|
+
await mkdir(targetDirPath, { recursive: true });
|
|
43
|
+
try {
|
|
44
|
+
// Read and process template
|
|
45
|
+
const templateContent = await readFile(sourcePath, "utf8");
|
|
46
|
+
const processedContent = ejs.render(templateContent, templateVars);
|
|
47
|
+
// Write processed file
|
|
48
|
+
await writeFile(targetPath, processedContent);
|
|
49
|
+
generatedFiles.push(path.relative(targetDir, targetPath));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw new Error(`Failed to process template file '${file}': ${error instanceof Error ?
|
|
53
|
+
error.message :
|
|
54
|
+
String(error)}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return generatedFiles.sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=templateProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateProcessor.js","sourceRoot":"","sources":["../../../src/tools/create_ui5_app/templateProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AA+DvD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAkC;IACxE,MAAM,EAAC,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAC,GAAG,OAAO,CAAC;IAE7E,8EAA8E;IAC9E,MAAM,aAAa,GAAG,cAAc,CAAC;IACrC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;IAErD,yBAAyB;IACzB,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE;QACxC,GAAG,EAAE,WAAW;KAChB,CAAC,CAAC;IACH,MAAM,cAAc,GAAG,EAAE,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QAClC,IAAI,UAAU,GAAG,IAAI,CAAC;QAEtB,4CAA4C;QAC5C,IAAI,oBAAoB,EAAE,CAAC;YAC1B,I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,IAAI,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC;gBACrE,KAAK,CAAC,OAAO,CAAC,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,EAAE,CACjB,CAAC;QACH,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC;AAC3G,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import getVersionInfo from "../get_version_info/getVersionInfo.js";
|
|
2
|
+
export async function getLatestUi5Version(framework) {
|
|
3
|
+
const versions = await getVersionInfo({ frameworkName: framework });
|
|
4
|
+
return versions.versions.latest.version;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=ui5Version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui5Version.js","sourceRoot":"","sources":["../../../src/tools/create_ui5_app/ui5Version.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,uCAAuC,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,SAAuB;IAChE,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAC,aAAa,EAAE,SAAS,EAAC,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { InvalidInputError } from "../../utils.js";
|
|
2
|
+
import { SymbolKind } from "./lib/ApiReferenceProvider.js";
|
|
3
|
+
const sdkDomain = new Map([
|
|
4
|
+
["sapui5", "https://ui5.sap.com"],
|
|
5
|
+
["openui5", "https://openui5.org"],
|
|
6
|
+
]);
|
|
7
|
+
export default function createUriForSymbol(symbol, frameworkName, frameworkVersion) {
|
|
8
|
+
const domain = sdkDomain.get(frameworkName.toLowerCase());
|
|
9
|
+
if (!domain) {
|
|
10
|
+
throw new InvalidInputError(`Unknown framework name: ${frameworkName}`);
|
|
11
|
+
}
|
|
12
|
+
let entityPath;
|
|
13
|
+
if (symbol.module) {
|
|
14
|
+
entityPath = symbol.module.replaceAll("/", ".");
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
// Some symbols like some namespaces might not have a module (e.g. sap.ui.model.odata)
|
|
18
|
+
entityPath = symbol.name;
|
|
19
|
+
}
|
|
20
|
+
let url = `${domain}/${frameworkVersion}/api/${entityPath}/`;
|
|
21
|
+
if (symbol.export) {
|
|
22
|
+
url += `${symbol.export}/`;
|
|
23
|
+
}
|
|
24
|
+
switch (symbol.kind) {
|
|
25
|
+
case SymbolKind.Constructor:
|
|
26
|
+
url += `constructor`;
|
|
27
|
+
break;
|
|
28
|
+
case SymbolKind.Ui5Aggregation:
|
|
29
|
+
url += `aggregations/${symbol.name}`;
|
|
30
|
+
break;
|
|
31
|
+
case SymbolKind.Ui5Association:
|
|
32
|
+
url += `associations/${symbol.name}`;
|
|
33
|
+
break;
|
|
34
|
+
case SymbolKind.Method:
|
|
35
|
+
url += `methods/${symbol.name}`;
|
|
36
|
+
break;
|
|
37
|
+
case SymbolKind.Function:
|
|
38
|
+
url += `functions/${symbol.name}`;
|
|
39
|
+
break;
|
|
40
|
+
case SymbolKind.Ui5Property:
|
|
41
|
+
url += `controlProperties/${symbol.name}`;
|
|
42
|
+
break;
|
|
43
|
+
case SymbolKind.Ui5Event:
|
|
44
|
+
url += `events/${symbol.name}`;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=createUriForSymbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUriForSymbol.js","sourceRoot":"","sources":["../../../src/tools/get_api_reference/createUriForSymbol.ts"],"names":[],"mappings":"AAAA,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AAE,CAAC;YACrC,MAAM;QACP,KAAK,UAAU,CAAC,MAAM;YACrB,GAAG,IAAI,WAAW,MAAM,CAAC,IAAI,EAAE,CAAC;YAChC,MAAM;QACP,KAAK,UAAU,CAAC,QAAQ;YACvB,GAAG,IAAI,aAAa,MAAM,CAAC,IAAI,EAAE,CAAC;YAClC,MAAM;QACP,KAAK,UAAU,CAAC,WAAW;YAC1B,GAAG,IAAI,qBAAqB,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1C,MAAM;QACP,KAAK,UAAU,CAAC,QAAQ;YACvB,GAAG,IAAI,UAAU,MAAM,CAAC,IAAI,EAAE,CAAC;YAC/B,MAAM;IACR,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ui5TypeInfo } from "@ui5/linter/Ui5TypeInfoMatcher";
|
|
2
|
+
import { Ui5Framework } from "../../utils/ui5Framework.js";
|
|
3
|
+
import { FormattedSymbol, FormattedSymbolSummary } from "./lib/formatSymbol.js";
|
|
4
|
+
/**
|
|
5
|
+
* Example: await getApiReference("sapui5", 1.120.30", "sap.ui.table.Table");
|
|
6
|
+
*/
|
|
7
|
+
export declare function getApiReference(query: string, frameworkName: Ui5Framework, frameworkVersion: string): Promise<FormattedSymbol[]>;
|
|
8
|
+
export declare function getApiReferenceSummary(query: string, frameworkName: Ui5Framework, frameworkVersion: string): Promise<(FormattedSymbol | FormattedSymbolSummary)[]>;
|
|
9
|
+
export declare function getApiReferenceForUi5Type(ui5TypeInfo: Ui5TypeInfo, frameworkName: Ui5Framework, frameworkVersion: string): Promise<FormattedSymbol>;
|
|
10
|
+
export declare function getApiReferenceSummaryForUi5Type(ui5TypeInfo: Ui5TypeInfo, frameworkName: Ui5Framework, frameworkVersion: string): Promise<FormattedSymbol | FormattedSymbolSummary>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import ApiReferenceProvider from "./lib/ApiReferenceProvider.js";
|
|
2
|
+
import { getApiJsonDir } from "./lib/apiReferenceResources.js";
|
|
3
|
+
import { Mutex } from "async-mutex";
|
|
4
|
+
async function createApiReferenceProvider(frameworkName, frameworkVersion) {
|
|
5
|
+
const apiJsonsRoot = await getApiJsonDir(frameworkName, frameworkVersion);
|
|
6
|
+
const apiRefProvider = await ApiReferenceProvider.create(apiJsonsRoot);
|
|
7
|
+
return apiRefProvider;
|
|
8
|
+
}
|
|
9
|
+
const apiRefProviders = new Map();
|
|
10
|
+
const apiRefProviderMutex = new Mutex();
|
|
11
|
+
async function getApiRefProvider(frameworkName, frameworkVersion) {
|
|
12
|
+
const key = `${frameworkName}-${frameworkVersion}`;
|
|
13
|
+
let apiRefProvider = apiRefProviders.get(key);
|
|
14
|
+
if (!apiRefProvider) {
|
|
15
|
+
const release = await apiRefProviderMutex.acquire();
|
|
16
|
+
try {
|
|
17
|
+
// Check again within the mutex
|
|
18
|
+
apiRefProvider = apiRefProviders.get(key);
|
|
19
|
+
if (!apiRefProvider) {
|
|
20
|
+
apiRefProvider = await createApiReferenceProvider(frameworkName, frameworkVersion);
|
|
21
|
+
apiRefProviders.set(key, apiRefProvider);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
release();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return apiRefProvider;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Example: await getApiReference("sapui5", 1.120.30", "sap.ui.table.Table");
|
|
32
|
+
*/
|
|
33
|
+
export async function getApiReference(query, frameworkName, frameworkVersion) {
|
|
34
|
+
const apiRefProvider = await getApiRefProvider(frameworkName, frameworkVersion);
|
|
35
|
+
const res = await apiRefProvider.findSymbol(query);
|
|
36
|
+
return Array.isArray(res) ? res : [res];
|
|
37
|
+
}
|
|
38
|
+
export async function getApiReferenceSummary(query, frameworkName, frameworkVersion) {
|
|
39
|
+
const apiRefProvider = await getApiRefProvider(frameworkName, frameworkVersion);
|
|
40
|
+
const res = await apiRefProvider.findSymbolAndSummarize(query);
|
|
41
|
+
return Array.isArray(res) ? res : [res];
|
|
42
|
+
}
|
|
43
|
+
export async function getApiReferenceForUi5Type(ui5TypeInfo, frameworkName, frameworkVersion) {
|
|
44
|
+
const apiRefProvider = await getApiRefProvider(frameworkName, frameworkVersion);
|
|
45
|
+
return await apiRefProvider.getSymbolForUi5Type(ui5TypeInfo);
|
|
46
|
+
}
|
|
47
|
+
export async function getApiReferenceSummaryForUi5Type(ui5TypeInfo, frameworkName, frameworkVersion) {
|
|
48
|
+
const apiRefProvider = await getApiRefProvider(frameworkName, frameworkVersion);
|
|
49
|
+
return await apiRefProvider.getSymbolForUi5TypeAndSummarize(ui5TypeInfo);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=getApiReference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getApiReference.js","sourceRoot":"","sources":["../../../src/tools/get_api_reference/getApiReference.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAGlC,KAAK,UAAU,0BAA0B,CAAC,aAA2B,EAAE,gBAAwB;IAC9F,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAC1E,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACvE,OAAO,cAAc,CAAC;AACvB,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;AAChE,MAAM,mBAAmB,GAAG,IAAI,KAAK,EAAE,CAAC;AACxC,KAAK,UAAU,iBAAiB,CAAC,aAA2B,EAAE,gBAAwB;IACrF,MAAM,GAAG,GAAG,GAAG,aAAa,IAAI,gBAAgB,EAAE,CAAC;IACnD,IAAI,cAAc,GAAG,eAAe,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,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,WAAwB,EAAE,aAA2B,EAAE,gBAAwB;IAE/E,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAChF,OAAO,MAAM,cAAc,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,WAAwB,EAAE,aAA2B,EAAE,gBAAwB;IAE/E,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAChF,OAAO,MAAM,cAAc,CAAC,+BAA+B,CAAC,WAAW,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { inputSchema } from "./schema.js";
|
|
2
|
+
import { getApiReference } from "./getApiReference.js";
|
|
3
|
+
import getProjectInfo from "../get_project_info/getProjectInfo.js";
|
|
4
|
+
import createUriForSymbol from "./createUriForSymbol.js";
|
|
5
|
+
import { getLogger } from "@ui5/logger";
|
|
6
|
+
const log = getLogger("tools:get_api_reference");
|
|
7
|
+
export default function registerTool(registerTool, context) {
|
|
8
|
+
registerTool("get_api_reference", {
|
|
9
|
+
description: "Search the UI5 API reference for module names and symbols",
|
|
10
|
+
annotations: {
|
|
11
|
+
title: "UI5 API Reference",
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
},
|
|
15
|
+
inputSchema,
|
|
16
|
+
}, async ({ projectDir, query }) => {
|
|
17
|
+
log.info(`Searching API reference with query '${query}' based on project '${projectDir}'`);
|
|
18
|
+
const resolvedProjectDir = await context.normalizePath(projectDir);
|
|
19
|
+
const projectInfo = await getProjectInfo(resolvedProjectDir);
|
|
20
|
+
const frameworkName = projectInfo.frameworkName ?? "OpenUI5";
|
|
21
|
+
const frameworkVersion = projectInfo.frameworkVersion ?? (projectInfo.frameworkName === "OpenUI5" ? "1.136.5" : "1.136.7");
|
|
22
|
+
const apiRef = await getApiReference(query, frameworkName, frameworkVersion);
|
|
23
|
+
return {
|
|
24
|
+
content: apiRef.map((apiRef) => createResource(apiRef, frameworkName, frameworkVersion)),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function createResource(apiRef, frameworkName, frameworkVersion) {
|
|
29
|
+
return {
|
|
30
|
+
type: "resource",
|
|
31
|
+
resource: {
|
|
32
|
+
text: JSON.stringify(apiRef, null, 2),
|
|
33
|
+
uri: createUriForSymbol(apiRef, frameworkName, frameworkVersion),
|
|
34
|
+
mimeType: "application/json",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/get_api_reference/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,cAAc,MAAM,uCAAuC,CAAC;AACnE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAMtC,MAAM,GAAG,GAAG,SAAS,CAAC,yBAAyB,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,YAA0B,EAAE,OAAgB;IAChF,YAAY,CAAC,mBAAmB,EAAE;QACjC,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE;YACZ,KAAK,EAAE,mBAAmB;YAC1B,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;SACpB;QACD,WAAW;KACX,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,EAAE;QAChC,GAAG,CAAC,IAAI,CAAC,uCAAuC,KAAK,uBAAuB,UAAU,GAAG,CAAC,CAAC;QAC3F,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,kBAAkB,CAAC,CAAC;QAC7D,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,IAAI,SAAS,CAAC;QAC7D,MAAM,gBAAgB,GACrB,WAAW,CAAC,gBAAgB,IAAI,CAAC,WAAW,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;QAE7E,OAAO;YACN,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;SACxF,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAAuB,EAAE,aAAqB,EAAE,gBAAwB;IAC/F,OAAO;QACN,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACT,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YACrC,GAAG,EAAE,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,gBAAgB,CAAC;YAChE,QAAQ,EAAE,kBAAkB;SAC5B;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ApiReferenceIndex } from "./apiReferenceResources.js";
|
|
2
|
+
import type { ConcreteSymbol, ObjMethod, ObjProperty, Ui5Property, ObjEvent, Ui5Event, EnumProperty, Ui5Aggregation, Ui5Association, Ui5SpecialSetting, ObjConstructor, ObjCallableParameter, NamespaceSymbol, SymbolBase, InterfaceSymbol, ClassSymbol, EnumSymbol } from "./api-json.js";
|
|
3
|
+
import { Ui5TypeInfo } from "@ui5/linter/Ui5TypeInfoMatcher";
|
|
4
|
+
import { FormattedSymbol, FormattedSymbolSummary } from "./formatSymbol.js";
|
|
5
|
+
interface SymbolCache {
|
|
6
|
+
symbols: Map<string, ConcreteSymbol>;
|
|
7
|
+
library: string;
|
|
8
|
+
}
|
|
9
|
+
interface SymbolInfo {
|
|
10
|
+
symbol: ConcreteSymbol | ConcreteSymbolField;
|
|
11
|
+
library: string;
|
|
12
|
+
moduleName: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
type AddToUnion<T, U> = T extends unknown ? T & U : never;
|
|
15
|
+
export declare enum SymbolKind {
|
|
16
|
+
Class = "class",
|
|
17
|
+
Interface = "interface",
|
|
18
|
+
Namespace = "namespace",
|
|
19
|
+
Enum = "enum",
|
|
20
|
+
Member = "member",// 'member' is treated like 'namespace' or 'object'
|
|
21
|
+
Object = "object",
|
|
22
|
+
Typedef = "typedef",
|
|
23
|
+
Function = "function",
|
|
24
|
+
Property = "property",
|
|
25
|
+
Constructor = "constructor",
|
|
26
|
+
Method = "method",
|
|
27
|
+
Event = "event",
|
|
28
|
+
Parameter = "parameter",
|
|
29
|
+
EnumProperty = "enum-property",
|
|
30
|
+
Ui5Property = "ui5-property",
|
|
31
|
+
Ui5Event = "ui5-event",
|
|
32
|
+
Ui5Aggregation = "ui5-aggregation",
|
|
33
|
+
Ui5Association = "ui5-association",
|
|
34
|
+
Ui5SpecialSetting = "ui5-specialSetting"
|
|
35
|
+
}
|
|
36
|
+
export type ConcreteSymbolField = AddToUnion<ObjMethod | ObjProperty | Ui5Property | ObjEvent | Ui5Event | EnumProperty | Ui5Aggregation | Ui5Association | Ui5SpecialSetting | ObjConstructor | ObjCallableParameter, {
|
|
37
|
+
kind: SymbolKind;
|
|
38
|
+
}>;
|
|
39
|
+
export default class ApiReferenceProvider {
|
|
40
|
+
private apiJsonsRootDir;
|
|
41
|
+
private index;
|
|
42
|
+
private symbolCache;
|
|
43
|
+
private apiJsonLoadMutex;
|
|
44
|
+
constructor(apiJsonsRootDir: string, index: ApiReferenceIndex);
|
|
45
|
+
static create(apiJsonsRootDir: string): Promise<ApiReferenceProvider>;
|
|
46
|
+
findSymbol(query: string): Promise<FormattedSymbol | FormattedSymbol[]>;
|
|
47
|
+
findSymbolAndSummarize(query: string): Promise<FormattedSymbol | FormattedSymbolSummary | (FormattedSymbol | FormattedSymbolSummary)[]>;
|
|
48
|
+
_findSymbol(query: string): Promise<SymbolInfo | SymbolInfo[]>;
|
|
49
|
+
_findSymbolsInModule(moduleName: string, symbolCache: SymbolCache): SymbolInfo[];
|
|
50
|
+
/**
|
|
51
|
+
* Searches for a field (e.g. method, property, event) by name within a UI5 symbol.
|
|
52
|
+
*
|
|
53
|
+
* @param symbol The ConcreteSymbol to search within.
|
|
54
|
+
* @param field The name of the field to find.
|
|
55
|
+
* @returns The found entity (method, property, event, etc.) or undefined if not found.
|
|
56
|
+
*/
|
|
57
|
+
_getFieldInSymbol(symbol: ConcreteSymbol, field: string): ConcreteSymbolField | undefined;
|
|
58
|
+
_findFieldByName<T extends {
|
|
59
|
+
name: string;
|
|
60
|
+
}>(fieldName: string, symbolFields: T[] | undefined, fieldKind: SymbolKind): ConcreteSymbolField | undefined;
|
|
61
|
+
getSymbolForUi5Type(ui5TypeInfo: Ui5TypeInfo): Promise<FormattedSymbol>;
|
|
62
|
+
getSymbolForUi5TypeAndSummarize(ui5TypeInfo: Ui5TypeInfo): Promise<FormattedSymbol | FormattedSymbolSummary>;
|
|
63
|
+
_getSymbolForUi5Type(ui5TypeInfo: Ui5TypeInfo): Promise<SymbolInfo>;
|
|
64
|
+
_parseUi5TypeInfo(ui5TypeInfo: Ui5TypeInfo): {
|
|
65
|
+
moduleName: string;
|
|
66
|
+
relevantNode: Ui5TypeInfo;
|
|
67
|
+
} | undefined;
|
|
68
|
+
_findSymbolForSubType(symbol: ClassSymbol | InterfaceSymbol | NamespaceSymbol | EnumSymbol, ui5TypeInfo: Ui5TypeInfo): ConcreteSymbol | ConcreteSymbolField | undefined;
|
|
69
|
+
_getApiJson(filePath: string): Promise<SymbolCache>;
|
|
70
|
+
/**
|
|
71
|
+
* Normalizes the search query by removing white space, replacing slashes and hashes with dots,
|
|
72
|
+
* and making it lower case (to allow case-insensitive search).
|
|
73
|
+
*
|
|
74
|
+
* @param query - The search query to normalize. E.g. " module:sap/ui/core/Component#onInit "
|
|
75
|
+
* @returns The normalized query. E.g. "sap.ui.core.Component"
|
|
76
|
+
*/
|
|
77
|
+
_normalizeForIndex(query: string): string;
|
|
78
|
+
_normalizeForModuleName(query: string): string;
|
|
79
|
+
}
|
|
80
|
+
export declare function isUi5ClassSymbol(symbol: SymbolBase): symbol is ClassSymbol;
|
|
81
|
+
export declare function isUi5InterfaceSymbol(symbol: SymbolBase): symbol is InterfaceSymbol;
|
|
82
|
+
export declare function isUi5NamespaceSymbol(symbol: SymbolBase): symbol is NamespaceSymbol;
|
|
83
|
+
export declare function isUi5EnumSymbol(symbol: SymbolBase): symbol is EnumSymbol;
|
|
84
|
+
export declare function isConcreteSymbol(symbol: ConcreteSymbol | ConcreteSymbolField): symbol is ConcreteSymbol;
|
|
85
|
+
export {};
|