@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
package/package.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ui5/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A MCP server for UI5",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "SAP SE",
|
|
7
|
+
"email": "openui5@sap.com",
|
|
8
|
+
"url": "https://www.sap.com"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"openui5",
|
|
13
|
+
"sapui5",
|
|
14
|
+
"ui5",
|
|
15
|
+
"development",
|
|
16
|
+
"mcp"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/UI5/mcp-server.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/UI5/mcp-server/issues"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"ui5mcp": "bin/ui5mcp.js"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"start": "tsx src/cli.ts",
|
|
31
|
+
"inspect-mcp-server": "mcp-inspector tsx src/cli.ts",
|
|
32
|
+
"inspect-mcp-server-debug": "mcp-inspector tsx --inspect src/cli.ts",
|
|
33
|
+
"build": "npm run clean-lib && tsc -p tsconfig.build.json",
|
|
34
|
+
"build-test": "tsc --noEmit -p .",
|
|
35
|
+
"build-watch": "npm run clean-lib && tsc -w -p tsconfig.build.json",
|
|
36
|
+
"check-licenses": "licensee --errors-only",
|
|
37
|
+
"depcheck": "depcheck --ignores @commitlint/config-conventional,@istanbuljs/esm-loader-hook,rimraf,@modelcontextprotocol/inspector",
|
|
38
|
+
"hooks:pre-push": "npm run lint:commit && npm run lint && npm run depcheck",
|
|
39
|
+
"lint:commit": "commitlint -e",
|
|
40
|
+
"prepare": "node ./.husky/skip.js || husky",
|
|
41
|
+
"clean-coverage": "rimraf coverage",
|
|
42
|
+
"clean-lib": "rimraf lib",
|
|
43
|
+
"clean-test-tmp": "rimraf test/tmp",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"lint-fix": "eslint . --fix",
|
|
46
|
+
"test": "npm run lint && npm run build-test && npm run coverage && npm run depcheck && npm run check-licenses",
|
|
47
|
+
"coverage": "npm run clean-coverage && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
|
|
48
|
+
"unit": "ava",
|
|
49
|
+
"unit-debug": "ava debug",
|
|
50
|
+
"unit-update-snapshots": "ava --update-snapshots",
|
|
51
|
+
"unit-watch": "ava --watch",
|
|
52
|
+
"try-create-ui5-app": "tsx test/runCreateUi5App.ts",
|
|
53
|
+
"try-create-ui5-ts-app": "tsx test/runCreateUi5TsApp.ts",
|
|
54
|
+
"update-docs": "tsx scripts/updateDocs.ts"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"CHANGELOG.md",
|
|
58
|
+
"LICENSES/**",
|
|
59
|
+
"bin/**",
|
|
60
|
+
"lib/**",
|
|
61
|
+
"resources/**",
|
|
62
|
+
"npm-shrinkwrap.json",
|
|
63
|
+
".reuse/**"
|
|
64
|
+
],
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": "^20.11.0 || >=22.0.0",
|
|
67
|
+
"npm": ">= 8"
|
|
68
|
+
},
|
|
69
|
+
"exports": {
|
|
70
|
+
".": {
|
|
71
|
+
"import": "./lib/api.js",
|
|
72
|
+
"types": "./lib/api.d.ts",
|
|
73
|
+
"default": "./lib/api.js"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@modelcontextprotocol/sdk": "^1.17.4",
|
|
78
|
+
"@ui5/linter": "^1.19.0",
|
|
79
|
+
"@ui5/logger": "^4.0.1",
|
|
80
|
+
"@ui5/project": "^4.0.4",
|
|
81
|
+
"async-mutex": "^0.5.0",
|
|
82
|
+
"ejs": "^3.1.10",
|
|
83
|
+
"execa": "^9.6.0",
|
|
84
|
+
"fast-xml-parser": "^5.2.5",
|
|
85
|
+
"globby": "^14.1.0",
|
|
86
|
+
"lockfile": "^1.0.4",
|
|
87
|
+
"make-fetch-happen": "^14.0.3",
|
|
88
|
+
"semver": "^7.7.2",
|
|
89
|
+
"zod": "^3.25.76"
|
|
90
|
+
},
|
|
91
|
+
"devDependencies": {
|
|
92
|
+
"@commitlint/cli": "^19.8.1",
|
|
93
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
94
|
+
"@eslint/js": "^9.34.0",
|
|
95
|
+
"@istanbuljs/esm-loader-hook": "^0.3.0",
|
|
96
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
97
|
+
"@modelcontextprotocol/inspector": "^0.16.5",
|
|
98
|
+
"@stylistic/eslint-plugin": "^5.2.3",
|
|
99
|
+
"@types/ejs": "^3.1.5",
|
|
100
|
+
"@types/make-fetch-happen": "^10.0.4",
|
|
101
|
+
"@types/node": "20.16.15",
|
|
102
|
+
"@types/semver": "^7.7.0",
|
|
103
|
+
"@types/sinon": "^17.0.4",
|
|
104
|
+
"@types/yauzl-promise": "^4.0.1",
|
|
105
|
+
"@ui5-language-assistant/semantic-model-types": "^3.3.1",
|
|
106
|
+
"ava": "^6.3.0",
|
|
107
|
+
"depcheck": "^1.4.7",
|
|
108
|
+
"eslint": "^9.34.0",
|
|
109
|
+
"eslint-plugin-ava": "^15.0.1",
|
|
110
|
+
"esmock": "^2.7.2",
|
|
111
|
+
"husky": "^9.1.7",
|
|
112
|
+
"licensee": "^11.1.1",
|
|
113
|
+
"nyc": "^17.1.0",
|
|
114
|
+
"rimraf": "^6.0.1",
|
|
115
|
+
"sinon": "^21.0.0",
|
|
116
|
+
"tsx": "^4.20.5",
|
|
117
|
+
"typescript": "^5.9.2",
|
|
118
|
+
"typescript-eslint": "^8.41.0",
|
|
119
|
+
"yauzl-promise": "^4.0.0"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Best Practices for Loading Modules
|
|
2
|
+
|
|
3
|
+
This section provides best practices for SAPUI5 module loading patterns.
|
|
4
|
+
|
|
5
|
+
These best practices are especially important when you switch from the synchronous variant of the SAPUI5 module loader to the asynchronous variant. Patterns that may have worked in synchronous module loading may lead to applications that can't start in asynchronous module loading.
|
|
6
|
+
|
|
7
|
+
> ### Note:
|
|
8
|
+
> Use the `async` configuration parameter to enable asynchronous module loading via the bootstrap. For more information, see [Standard Variant for Bootstrapping](standard-variant-for-bootstrapping-91f1f45.md).
|
|
9
|
+
|
|
10
|
+
## How to Define Modules
|
|
11
|
+
|
|
12
|
+
Every SAPUI5 module file must contain exactly one unnamed module definition on the top level: the `sap.ui.define` call. Also, to avoid side-effects, all module-related functions must be defined within the callback function.
|
|
13
|
+
|
|
14
|
+
**Example**: The following two modules are unnamed. They only contain one top-level `sap.ui.define` and can be addressed with the respective unique module name:
|
|
15
|
+
|
|
16
|
+
`myLib/MyModuleA.js`
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
sap.ui.define(function(){
|
|
20
|
+
...
|
|
21
|
+
});
|
|
22
|
+
...
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For troubleshooting information with regard to loading your module, see [Why is my Module Not Loading?](troubleshooting-for-loading-modules-4363b3f.md#loio4363b3fe3561414ca1b030afc8cd30ce__section_moduleloading).
|
|
26
|
+
|
|
27
|
+
## How to Address Modules
|
|
28
|
+
|
|
29
|
+
A module must always be addressed with the unique module name. The module name is case-sensitive.
|
|
30
|
+
|
|
31
|
+
`myLib/MyModuleB.js`
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
sap.ui.define(["myLib/MyModuleA"], function(MyModuleA){
|
|
35
|
+
...
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For troubleshooting information with regard to addressing modules, see [What is wrong with the way I am addressing the modules?](troubleshooting-for-loading-modules-4363b3f.md#loio4363b3fe3561414ca1b030afc8cd30ce__section_moduleaddressing).
|
|
40
|
+
|
|
41
|
+
### Migrating Access to Pseudo Modules
|
|
42
|
+
|
|
43
|
+
Historically, types that are defined within a `library.js` could be required as if they were modules of their own \(i.e. as "pseudo modules"\). This behavior is deprecated, and the corresponding `library` module should be required instead. The example below showcases three scenarios how types might be used. You can find the corresponding module for each API, enum, and control in the API Reference, e.g. [`sap.m.ButtonType`](https://ui5.sap.com/#/api/sap.m.ButtonType) and [`sap.ui.model.FilterType`](https://ui5.sap.com/#/api/sap.ui.model.FilterType).
|
|
44
|
+
|
|
45
|
+
- enum types included in a `library.js`
|
|
46
|
+
|
|
47
|
+
e.g. you can use `sap.m.ButtonType` by requiring the `sap/m/library` module since it's documented as "Module: sap/m/library" in the API Reference. The type can then be accessed via the library's module export.
|
|
48
|
+
|
|
49
|
+
- enum types provided as a standalone module
|
|
50
|
+
|
|
51
|
+
e.g. you should require `sap/ui/model/FilterType` directly since it's documented as "Module: sap/ui/model/FilterType"
|
|
52
|
+
|
|
53
|
+
- Instances of DataType included in a `library.js`
|
|
54
|
+
|
|
55
|
+
e.g. you can use `sap.ui.core.CSSSize` by first requiring the `sap/ui/core/library` module as documented in the API Reference. The DataType itself can then be accessed via the static [`DataType.getType(...)`](https://ui5.sap.com/#/api/sap.ui.base.DataType/methods/sap.ui.base.DataType.getType) API as shown below.
|
|
56
|
+
|
|
57
|
+
> ### Note:
|
|
58
|
+
> Accessing the DataType instance via the library's module export is also deprecated.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
sap.ui.require([
|
|
65
|
+
"sap/m/library", // enum sap.m.ButtonType (Module: sap/m/library)
|
|
66
|
+
"sap/ui/model/FilterType", // enum sap.ui.model.FilterType (Module: sap/ui/model/FilterType)
|
|
67
|
+
"sap/ui/base/DataType", // DataType facade (Module: sap/ui/base/DataType)
|
|
68
|
+
"sap/ui/core/library" // includes the DataType "sap.ui.core.CSSSize" (Module: sap/ui/core/library)
|
|
69
|
+
], (sapMLib, FilterType, DataType /*, sapUiCoreLib*/) => {
|
|
70
|
+
const { ButtonType } = sapMLib;
|
|
71
|
+
|
|
72
|
+
mySapMButton.setType(ButtonType.Emphasized);
|
|
73
|
+
|
|
74
|
+
myListBinding.filter(myFilter, FilterType.Application);
|
|
75
|
+
|
|
76
|
+
const oCSSSize = DataType.getType("sap.ui.core.CSSSize");
|
|
77
|
+
oCSSSize.isValid("20px") // true
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Example for migrating several legacy aspects:**
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
<table>
|
|
85
|
+
<tr>
|
|
86
|
+
<th valign="top" align="center">
|
|
87
|
+
|
|
88
|
+
Legacy Code
|
|
89
|
+
|
|
90
|
+
</th>
|
|
91
|
+
<th valign="top" align="center">
|
|
92
|
+
|
|
93
|
+
Best Practice
|
|
94
|
+
|
|
95
|
+
</th>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td valign="top">
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
sap.ui.define([
|
|
102
|
+
"sap/m/SortOrder", // Outdated pseudo module
|
|
103
|
+
"sap/ui/model/FilterType", // standalone module
|
|
104
|
+
"sap/ui/layout" // target use: SimpleForm
|
|
105
|
+
], (SortOrder, FilterType, sapUiLayoutLib) => {
|
|
106
|
+
"use strict"
|
|
107
|
+
var SimpleForm = sapUiLayoutLib.form.SimpleForm; // access to Control via globals
|
|
108
|
+
|
|
109
|
+
// ...
|
|
110
|
+
|
|
111
|
+
// access to Control via globals
|
|
112
|
+
sap.m.MessageBox.show(/*...*/);
|
|
113
|
+
|
|
114
|
+
// ...
|
|
115
|
+
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
</td>
|
|
120
|
+
<td valign="top">
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
sap.ui.define([
|
|
124
|
+
"sap/m/library", // "SortOrder" is contained in the sap/m/library.js module
|
|
125
|
+
"sap/ui/model/FilterType", // remains the same
|
|
126
|
+
"sap/ui/layout/form/SimpleForm" // imported as a module, no access to globals needed
|
|
127
|
+
], (sapMLib, FilterType, SimpleForm) => {
|
|
128
|
+
"use strict";
|
|
129
|
+
const { SortOrder } = sapMLib;
|
|
130
|
+
|
|
131
|
+
// ...
|
|
132
|
+
|
|
133
|
+
// lazily require the sap/m/MessageBox on demand
|
|
134
|
+
sap.ui.require([
|
|
135
|
+
"sap/m/MessageBox"
|
|
136
|
+
], (MessageBox) => {
|
|
137
|
+
MessageBox.show(/*...*/);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// ...
|
|
141
|
+
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
</td>
|
|
146
|
+
</tr>
|
|
147
|
+
</table>
|
|
148
|
+
|
|
149
|
+
## How to Structure a Project
|
|
150
|
+
|
|
151
|
+
The entry point of an SAPUI5 application is often a module that is used to instantiate a SAPUI5 component. This central module is considered as single node of a graph and all dependent modules as well as their dependencies are nodes that must be connected by directed edges: the graph must fulfill the requirements of a directed acyclic graph \(DAG\).
|
|
152
|
+
|
|
153
|
+
**Example**: All modules are evaluated in a clearly defined order. The evaluation starts with module D, then module C and module B, and ends with module A.
|
|
154
|
+
|
|
155
|
+
For troubleshooting information with regard to the project structure, see [How can I remove project structures with cyclic dependencies?](troubleshooting-for-loading-modules-4363b3f.md#loio4363b3fe3561414ca1b030afc8cd30ce__section_cyclicdependencies).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Component Metadata
|
|
2
|
+
|
|
3
|
+
The component class provides specific metadata for components by extending the `ManagedObject` class. The `UIComponent` class provides additional metadata for the configuration of user interfaces or the navigation between views.
|
|
4
|
+
|
|
5
|
+
> ### Note:
|
|
6
|
+
> With the introduction of the descriptor for applications, components, and libraries, we recommend to migrate the component metadata to the descriptor. The descriptor is inspired by W3C's Web Application Manifest and provides comprehensive information for applications, components and libraries. For more information, see [Manifest \(Descriptor for Applications, Components, and Libraries\)](manifest-descriptor-for-applications-components-and-libraries-be0cf40.md). The metadata property `manifest` must be set to `json` to indicate that the `manifest.json` file should be loaded and used:
|
|
7
|
+
>
|
|
8
|
+
> ```js
|
|
9
|
+
> // "Component" required from module "sap/ui/core/Component"
|
|
10
|
+
> Component.extend("some.sample.Component", {
|
|
11
|
+
> "metadata": {
|
|
12
|
+
> "manifest": "json"
|
|
13
|
+
> }
|
|
14
|
+
> });
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> You can also define the descriptor inline by just providing an object. However, we do **not** recommend this because this would prevent that the descriptor can be analyzed by tools.
|
|
18
|
+
|
|
19
|
+
The metadata defined in `Component.js` is common for components. The following parameters are available:
|
|
20
|
+
|
|
21
|
+
- `manifest`: Specifies if your component uses the descriptor
|
|
22
|
+
|
|
23
|
+
- `abstract`: Specifies if your component class is an abstract class that serves as a base for other components
|
|
24
|
+
|
|
25
|
+
- `version`: Version of your component; this parameter belongs to the design time metadata and is currently not used; it may be used in the future in the design time repository
|
|
26
|
+
|
|
27
|
+
- `properties`, `aggregations`, `associations`, and `events`: Define these for your component in the same way as for a control. For more information, see [Defining the Control Metadata](../09_Developing_Controls/defining-the-control-metadata-7b52540.md).
|
|
28
|
+
|
|
29
|
+
- `library`: Specifies the library to which your component belongs to
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
The following properties are deprecated and no longer needed if you use the descriptor:
|
|
33
|
+
|
|
34
|
+
- `includes`: Array of strings containing the paths to CSS and JavaScript resources for your component; will be added to the header of the HTML page and loaded by the browser. The resources will be resolved relative to the location of `Component.js`.
|
|
35
|
+
|
|
36
|
+
- `dependencies`: Used to specify all external dependencies, such as libraries or components. Like the includes for resources that are added to the application's HTML, the dependencies are loaded by SAPUI5 core before the component is initialized. Everything that is referenced here can be used in your component code right from the start. Specify here external dependences such as libraries or components, that will be loaded by SAPUI5 core in the initialization phase of your Component and can be used after it.
|
|
37
|
+
|
|
38
|
+
- `libs`: Path to the libraries that should be loaded by SAPUI5 core to be used in your component
|
|
39
|
+
|
|
40
|
+
- `components`: Full path to the components that should be loaded by SAPUI5 core to be used in your component
|
|
41
|
+
|
|
42
|
+
- `ui5version`: Minimum version of SAPUI5 that the component requires; it helps to be ensure that the features of SAPUI5 runtime used in this component are available. As SAPUI5 currently does not enforce the use of the correct version, it is only used for information purposes.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
- `config`: Static configuration; specify the name-value pairs that you need in the component
|
|
46
|
+
|
|
47
|
+
- `customizing`: Extensions for components and views, see [Extending Apps](../08_Extending_SAPUI5_Applications/extending-apps-a264a9a.md)
|
|
48
|
+
|
|
49
|
+
- `sap.ui.viewExtensions`: Used for providing custom view content in a specified extension point in the standard application
|
|
50
|
+
|
|
51
|
+
- `sap.ui.viewModifications`: Used for overriding control properties in the standard application
|
|
52
|
+
|
|
53
|
+
- `sap.ui.viewReplacements`: Used for replacing a standard view with a custom view
|
|
54
|
+
|
|
55
|
+
- `sap.ui.controllerExtensions`: Used for extending a controller in a delivered standard application with a custom controller
|
|
56
|
+
|
|
57
|
+
- `sap.ui.controllerReplacements`: Used for replacing a controller in a delivered standard application with a custom controller
|
|
58
|
+
|
|
59
|
+
Example for metadata in `Component.js`:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// "Component" required from module "sap/ui/core/Component"
|
|
63
|
+
Component.extend("some.sample.Component", {
|
|
64
|
+
"metadata": {
|
|
65
|
+
"manifest": "json", // Specifies that your Component class uses the descriptor via the manifest.json file
|
|
66
|
+
"abstract": true, // Specifies if your Component class is an abstract one that serves as a base for your other components
|
|
67
|
+
"library": "sap.ui.core", // Specifies the library the component belongs to
|
|
68
|
+
"version": "1.0", // Version of your Component
|
|
69
|
+
"properties": { // Defined for components in the same way as for a control or view
|
|
70
|
+
"config": "any"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
In addition to the common metadata for components, the `UIComponent` class provides the following metadata for UI components:
|
|
77
|
+
|
|
78
|
+
- `publicMethods`: Definition of public methods for your component
|
|
79
|
+
|
|
80
|
+
- `aggregations`: Defines aggregations for your component
|
|
81
|
+
|
|
82
|
+
- `interfaces`: Defines the interfaces implemented by your component.
|
|
83
|
+
|
|
84
|
+
We recommend to add the `sap.ui.core.IAsyncContentCreation` marker interface when defining a new component. Using this interface allows the component to be created fully asynchronously. This interface will implicitly set the component's `rootView` and router configuration to `async`. Nested views will also be handled asynchronously. Additionally, the error handling during the processing of views is stricter and will fail if a view definition contains errors, e.g. broken binding strings.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
The following properties are deprecated and no longer needed if you use the descriptor:
|
|
88
|
+
|
|
89
|
+
- `rootView`: Can be the view name as string or the view configuration object
|
|
90
|
+
|
|
91
|
+
- `routing`: Provides the default values for all views
|
|
92
|
+
|
|
93
|
+
- `config`: Default values for routing that are applied, if no setting is specified by a route
|
|
94
|
+
|
|
95
|
+
- `viewType`: View type of the view that is created, for example XML, JS or HTML
|
|
96
|
+
|
|
97
|
+
- `viewPath`: Prefix that is preceding the view
|
|
98
|
+
|
|
99
|
+
- `targetParent`: ID of the view in which the `targetControl` is searched
|
|
100
|
+
|
|
101
|
+
- `targetControl`: ID of the control that contains the views
|
|
102
|
+
|
|
103
|
+
- `targetAggregation`: Name of the aggregation of the `targetControl` that contains views
|
|
104
|
+
|
|
105
|
+
- `clearTarget`: Boolean; if set to `true`, the aggregation should be cleared before adding the View to it
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- `routes`: Contains the configuration objects
|
|
109
|
+
|
|
110
|
+
- `name`: Mandatory parameter used for listening or navigating to the route
|
|
111
|
+
|
|
112
|
+
- `pattern`: String that is matched against the hash. The \{\} means this segment of the URL is passed to a handler with the value it contains
|
|
113
|
+
|
|
114
|
+
- `view`: Name of the view that is created
|
|
115
|
+
|
|
116
|
+
Example for UI component metadata:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
// "UIComponent" required from module "sap/ui/core/UIComponent"
|
|
120
|
+
UIComponent.extend("some.sample.UIComponent", {
|
|
121
|
+
"metadata": {
|
|
122
|
+
"publicMethods": [ "render" ],
|
|
123
|
+
"aggregations": {
|
|
124
|
+
"rootControl": {
|
|
125
|
+
"type": "sap.ui.core.Control", multiple: false, visibility: "hidden"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Properties Section in Component Metadata
|
|
133
|
+
|
|
134
|
+
You can add a properties section to the metadata for all properties that can adopt different values during runtime. The getters and setters for these properties are generated automatically, but you can overwrite them if you require additional functionality. The following example contains two properties at the end of the metadata section.
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
// "UIComponent" required from module "sap/ui/core/UIComponent"
|
|
138
|
+
UIComponent.extend("samples.components.shell.Component", {
|
|
139
|
+
"metadata": {
|
|
140
|
+
"abstract": true,
|
|
141
|
+
"version": "1.0",
|
|
142
|
+
...
|
|
143
|
+
"properties": {
|
|
144
|
+
"appTitle": {
|
|
145
|
+
"name":"appTitle",
|
|
146
|
+
"type":"string",
|
|
147
|
+
"defaultValue":"Default Value that will be replaced with something meaningful through the setter for this property"
|
|
148
|
+
},
|
|
149
|
+
"someOtherProp": {
|
|
150
|
+
"name":"myProperty",
|
|
151
|
+
"type":"string",
|
|
152
|
+
"defaultValue":"Some text"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The getters and setters for these properties are generated automatically and can be overwritten if additional functionality is required.
|
|
160
|
+
|
|
161
|
+
**Related Information**
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
[API Reference: `sap.ui.core.Component.MetadataOptions`](https://ui5.sap.com/#/api/sap.ui.core.Component.MetadataOptions)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Test Starter
|
|
2
|
+
|
|
3
|
+
The test starter is a concept intended to simplify the test setup for SAPUI5 applications and libraries by orchestrating your QUnit and OPA5 tests.
|
|
4
|
+
|
|
5
|
+
## Goals
|
|
6
|
+
|
|
7
|
+
Using the test starter concept in your project:
|
|
8
|
+
|
|
9
|
+
- reduces the boiler plate code needed to write a QUnit test;
|
|
10
|
+
- ensures the loading of the most commonly used testing frameworks \(for example, QUnit, Sinon.JS, qunit-reporter\);
|
|
11
|
+
- ensures these testing frameworks and your test modules are loaded completely asynchronously and comply with the [Content Security Policy](../05_Developing_Apps/content-security-policy-fe1a6db.md);
|
|
12
|
+
- allows moving the configuration of the testing frameworks out of the test code.
|