diff --git a/samples/bookshop/.cdsrc.json b/samples/bookshop/.cdsrc.json index a1e4536..1cb5db6 100644 --- a/samples/bookshop/.cdsrc.json +++ b/samples/bookshop/.cdsrc.json @@ -1,14 +1,8 @@ { "requires": { "db": "hana", - "AICore": { - "model": "@cap-js/ai/srv/AICoreService" - }, "[production]": { "auth": "xsuaa" } - }, - "cdsc": { - "moduleLookupDirectories": ["node_modules/", "target/cds/"] } } diff --git a/samples/bookshop/package-lock.json b/samples/bookshop/package-lock.json index 42b2bd4..1318b90 100644 --- a/samples/bookshop/package-lock.json +++ b/samples/bookshop/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@cap-js/ai": "^1", "@sap/cds": "^9", "@sap/cds-common-content": "^1.4.0" }, @@ -17,21 +16,6 @@ "@sap/cds-dk": "^9.3.2" } }, - "node_modules/@cap-js/ai": { - "version": "1.0.1", - "resolved": "https://int.repositories.cloud.sap/artifactory/api/npm/build-releases-npm/@cap-js/ai/-/ai-1.0.1.tgz", - "integrity": "sha512-QE5JZTvbptGpcpSy+KgSn6IwQuB7ugmNWQ0dpX7OwXjB5MIn2utKKjrkWy0Gs1O0mEJEARl6w519UtZiY30ufQ==", - "license": "Apache-2.0", - "workspaces": [ - "tests/*" - ], - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "@sap/cds": ">=9" - } - }, "node_modules/@eslint/js": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", diff --git a/samples/bookshop/package.json b/samples/bookshop/package.json index a3884b0..17a9289 100644 --- a/samples/bookshop/package.json +++ b/samples/bookshop/package.json @@ -8,7 +8,6 @@ "@sap/cds-dk": "^9.3.2" }, "dependencies": { - "@cap-js/ai": "^1", "@sap/cds": "^9", "@sap/cds-common-content": "^1.4.0" }, diff --git a/samples/bookshop/pom.xml b/samples/bookshop/pom.xml index a19d522..480b012 100644 --- a/samples/bookshop/pom.xml +++ b/samples/bookshop/pom.xml @@ -52,17 +52,6 @@ ${cds-starter-ai.version} - - com.sap.cds - cds-feature-recommendations - ${cds-starter-ai.version} - - - - com.sap.cds - cds-feature-attachments - ${cds-feature-attachments.version} - diff --git a/samples/bookshop/srv/ai-core-service.cds b/samples/bookshop/srv/ai-core-service.cds index 1fc24c8..7124cc4 100644 --- a/samples/bookshop/srv/ai-core-service.cds +++ b/samples/bookshop/srv/ai-core-service.cds @@ -1,4 +1,4 @@ -using { AICore } from '@cap-js/ai/srv/AICoreService'; +using { AICore } from 'com.sap.cds/ai'; service AICoreShowcaseService @(requires: 'any') { diff --git a/samples/bookshop/srv/pom.xml b/samples/bookshop/srv/pom.xml index c7088ce..38aab48 100644 --- a/samples/bookshop/srv/pom.xml +++ b/samples/bookshop/srv/pom.xml @@ -61,16 +61,6 @@ cds-starter-ai - - com.sap.cds - cds-feature-recommendations - - - - com.sap.cds - cds-feature-attachments - - org.springframework.security spring-security-test diff --git a/samples/bookshop/srv/recommendations.cds b/samples/bookshop/srv/recommendations.cds new file mode 100644 index 0000000..30de412 --- /dev/null +++ b/samples/bookshop/srv/recommendations.cds @@ -0,0 +1,38 @@ +// Manual SAP_Recommendations model definition. +// This replaces the compile-time enhancement that @cap-js/ai's cds-plugin.js +// would normally generate automatically for all draft-enabled entities with +// value-list fields. +// When adding @cap-js/ai as a dependency in the package.json, such a file is *not* needed. + +using { AdminService } from './admin-service'; + +// Virtual entity holding recommendation results for Books. +// The structure mirrors what the node plugin generates: one arrayed element per +// value-list field, each containing the standard recommendation sub-elements. +@cds.persistence.skip +entity AdminService.Books_Recommendations { + key technicalRecommendationsIdentifier : UUID; + virtual genre_ID : many { + RecommendedFieldValue : Integer; + RecommendedFieldDescription : String; + RecommendedFieldScoreValue : Decimal; + RecommendedFieldIsSuggestion : Boolean; + }; + virtual currency_code : many { + RecommendedFieldValue : String(3); + RecommendedFieldDescription : String; + RecommendedFieldScoreValue : Decimal; + RecommendedFieldIsSuggestion : Boolean; + }; +} + +// Add SAP_Recommendations navigation property to Books. +// The on-condition is trivial (entity is @cds.persistence.skip, never queried from DB). +// Use 'extend ... with columns' because AdminService.Books is a projection. +extend AdminService.Books with columns { + SAP_Recommendations : Association to one AdminService.Books_Recommendations + on 1 = 1 +} + +// Tells Fiori Elements to auto-expand SAP_Recommendations on draft reads. +annotate AdminService.Books with @UI.Recommendations: SAP_Recommendations;