summaryrefslogtreecommitdiffstats
path: root/cds-ui/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/server/src')
-rw-r--r--cds-ui/server/src/application.ts63
-rw-r--r--cds-ui/server/src/controllers/README.md30
-rw-r--r--cds-ui/server/src/controllers/blueprint-rest.controller.ts160
-rw-r--r--cds-ui/server/src/controllers/index.ts22
-rw-r--r--cds-ui/server/src/controllers/ping.controller.ts72
-rw-r--r--cds-ui/server/src/datasources/README.md24
-rw-r--r--cds-ui/server/src/datasources/db.datasource.json6
-rw-r--r--cds-ui/server/src/datasources/db.datasource.ts36
-rw-r--r--cds-ui/server/src/datasources/index.ts23
-rw-r--r--cds-ui/server/src/datasources/rest.config.json39
-rw-r--r--cds-ui/server/src/datasources/rest.datasource.ts32
-rw-r--r--cds-ui/server/src/index.ts37
-rw-r--r--cds-ui/server/src/migrate.ts41
-rw-r--r--cds-ui/server/src/models/README.md24
-rw-r--r--cds-ui/server/src/models/blueprint.model.ts52
-rw-r--r--cds-ui/server/src/models/index.ts23
-rw-r--r--cds-ui/server/src/repositories/README.md24
-rw-r--r--cds-ui/server/src/repositories/blueprint.repository.ts37
-rw-r--r--cds-ui/server/src/repositories/index.ts23
-rw-r--r--cds-ui/server/src/sequence.ts56
-rw-r--r--cds-ui/server/src/services/rest.service.ts46
21 files changed, 870 insertions, 0 deletions
diff --git a/cds-ui/server/src/application.ts b/cds-ui/server/src/application.ts
new file mode 100644
index 000000000..463f330b8
--- /dev/null
+++ b/cds-ui/server/src/application.ts
@@ -0,0 +1,63 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { BootMixin } from '@loopback/boot';
+import { ApplicationConfig } from '@loopback/core';
+import {
+ RestExplorerBindings,
+ RestExplorerComponent,
+} from '@loopback/rest-explorer';
+import { RepositoryMixin } from '@loopback/repository';
+import { RestApplication } from '@loopback/rest';
+import { ServiceMixin } from '@loopback/service-proxy';
+import * as path from 'path';
+import { MySequence } from './sequence';
+
+export class CdsUiServerApplication extends BootMixin(
+ ServiceMixin(RepositoryMixin(RestApplication)),
+) {
+ constructor(options: ApplicationConfig = {}) {
+ super(options);
+
+ // Set up the custom sequence
+ this.sequence(MySequence);
+
+ // Set up default home page
+ this.static('/', path.join(__dirname, '../../public'));
+
+ // Customize @loopback/rest-explorer configuration here
+ this.bind(RestExplorerBindings.CONFIG).to({
+ path: '/explorer',
+ });
+ this.component(RestExplorerComponent);
+
+ this.projectRoot = __dirname;
+ // Customize @loopback/boot Booter Conventions here
+ this.bootOptions = {
+ controllers: {
+ // Customize ControllerBooter Conventions here
+ dirs: ['controllers'],
+ extensions: ['.controller.js'],
+ nested: true,
+ },
+ };
+ }
+}
diff --git a/cds-ui/server/src/controllers/README.md b/cds-ui/server/src/controllers/README.md
new file mode 100644
index 000000000..837a462dc
--- /dev/null
+++ b/cds-ui/server/src/controllers/README.md
@@ -0,0 +1,30 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+# Controllers
+
+This directory contains source files for the controllers exported by this app.
+
+To add a new empty controller, type in `lb4 controller [<name>]` from the
+command-line of your application's root directory.
+
+For more information, please visit
+[Controller generator](http://loopback.io/doc/en/lb4/Controller-generator.html).
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
new file mode 100644
index 000000000..960f09fbe
--- /dev/null
+++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
@@ -0,0 +1,160 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+
+import {
+ Count,
+ CountSchema,
+ Filter,
+ repository,
+ Where,
+} from '@loopback/repository';
+import {
+ post,
+ param,
+ get,
+ getFilterSchemaFor,
+ getWhereSchemaFor,
+ patch,
+ put,
+ del,
+ requestBody,
+} from '@loopback/rest';
+import {Blueprint} from '../models';
+import {BlueprintRepository} from '../repositories';
+
+export class BlueprintRestController {
+ constructor(
+ @repository(BlueprintRepository)
+ public blueprintRepository : BlueprintRepository,
+ ) {}
+
+ @post('/blueprints', {
+ responses: {
+ '200': {
+ description: 'Blueprint model instance',
+ content: {'application/json': {schema: {'x-ts-type': Blueprint}}},
+ },
+ },
+ })
+ async create(@requestBody() blueprint: Blueprint): Promise<Blueprint> {
+ return await this.blueprintRepository.create(blueprint);
+ }
+
+ @get('/blueprints/count', {
+ responses: {
+ '200': {
+ description: 'Blueprint model count',
+ content: {'application/json': {schema: CountSchema}},
+ },
+ },
+ })
+ async count(
+ @param.query.object('where', getWhereSchemaFor(Blueprint)) where?: Where,
+ ): Promise<Count> {
+ return await this.blueprintRepository.count(where);
+ }
+
+ @get('/blueprints', {
+ responses: {
+ '200': {
+ description: 'Array of Blueprint model instances',
+ content: {
+ 'application/json': {
+ schema: {type: 'array', items: {'x-ts-type': Blueprint}},
+ },
+ },
+ },
+ },
+ })
+ async find(
+ @param.query.object('filter', getFilterSchemaFor(Blueprint)) filter?: Filter,
+ ): Promise<Blueprint[]> {
+ return await this.blueprintRepository.find(filter);
+ }
+
+ @patch('/blueprints', {
+ responses: {
+ '200': {
+ description: 'Blueprint PATCH success count',
+ content: {'application/json': {schema: CountSchema}},
+ },
+ },
+ })
+ async updateAll(
+ @requestBody() blueprint: Blueprint,
+ @param.query.object('where', getWhereSchemaFor(Blueprint)) where?: Where,
+ ): Promise<Count> {
+ return await this.blueprintRepository.updateAll(blueprint, where);
+ }
+
+ @get('/blueprints/{id}', {
+ responses: {
+ '200': {
+ description: 'Blueprint model instance',
+ content: {'application/json': {schema: {'x-ts-type': Blueprint}}},
+ },
+ },
+ })
+ async findById(@param.path.number('id') id: number): Promise<Blueprint> {
+ return await this.blueprintRepository.findById(id);
+ }
+
+ @patch('/blueprints/{id}', {
+ responses: {
+ '204': {
+ description: 'Blueprint PATCH success',
+ },
+ },
+ })
+ async updateById(
+ @param.path.number('id') id: number,
+ @requestBody() blueprint: Blueprint,
+ ): Promise<void> {
+ await this.blueprintRepository.updateById(id, blueprint);
+ }
+
+ @put('/blueprints/{id}', {
+ responses: {
+ '204': {
+ description: 'Blueprint PUT success',
+ },
+ },
+ })
+ async replaceById(
+ @param.path.number('id') id: number,
+ @requestBody() blueprint: Blueprint,
+ ): Promise<void> {
+ await this.blueprintRepository.replaceById(id, blueprint);
+ }
+
+ @del('/blueprints/{id}', {
+ responses: {
+ '204': {
+ description: 'Blueprint DELETE success',
+ },
+ },
+ })
+ async deleteById(@param.path.number('id') id: number): Promise<void> {
+ await this.blueprintRepository.deleteById(id);
+ }
+}
diff --git a/cds-ui/server/src/controllers/index.ts b/cds-ui/server/src/controllers/index.ts
new file mode 100644
index 000000000..bf2bd6fb7
--- /dev/null
+++ b/cds-ui/server/src/controllers/index.ts
@@ -0,0 +1,22 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+export * from './ping.controller';
diff --git a/cds-ui/server/src/controllers/ping.controller.ts b/cds-ui/server/src/controllers/ping.controller.ts
new file mode 100644
index 000000000..d3098bc69
--- /dev/null
+++ b/cds-ui/server/src/controllers/ping.controller.ts
@@ -0,0 +1,72 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { Request, RestBindings, get, ResponseObject } from '@loopback/rest';
+import { inject } from '@loopback/context';
+
+/**
+ * OpenAPI response for ping()
+ */
+const PING_RESPONSE: ResponseObject = {
+ description: 'Ping Response',
+ content: {
+ 'application/json': {
+ schema: {
+ type: 'object',
+ properties: {
+ greeting: { type: 'string' },
+ date: { type: 'string' },
+ url: { type: 'string' },
+ headers: {
+ type: 'object',
+ properties: {
+ 'Content-Type': { type: 'string' },
+ },
+ additionalProperties: true,
+ },
+ },
+ },
+ },
+ },
+};
+
+/**
+ * A simple controller to bounce back http requests
+ */
+export class PingController {
+ constructor(@inject(RestBindings.Http.REQUEST) private req: Request) { }
+
+ // Map to `GET /ping`
+ @get('/ping', {
+ responses: {
+ '200': PING_RESPONSE,
+ },
+ })
+ ping(): object {
+ // Reply with a greeting, the current time, the url, and request headers
+ return {
+ greeting: 'Hello from LoopBack',
+ date: new Date(),
+ url: this.req.url,
+ headers: Object.assign({}, this.req.headers),
+ };
+ }
+}
diff --git a/cds-ui/server/src/datasources/README.md b/cds-ui/server/src/datasources/README.md
new file mode 100644
index 000000000..2d4d4c3be
--- /dev/null
+++ b/cds-ui/server/src/datasources/README.md
@@ -0,0 +1,24 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+# Datasources
+
+This directory contains config for datasources used by this app.
diff --git a/cds-ui/server/src/datasources/db.datasource.json b/cds-ui/server/src/datasources/db.datasource.json
new file mode 100644
index 000000000..a68f220be
--- /dev/null
+++ b/cds-ui/server/src/datasources/db.datasource.json
@@ -0,0 +1,6 @@
+{
+ "name": "db",
+ "connector": "memory",
+ "localStorage": "",
+ "file": "./data/db.json"
+}
diff --git a/cds-ui/server/src/datasources/db.datasource.ts b/cds-ui/server/src/datasources/db.datasource.ts
new file mode 100644
index 000000000..f1b19a1af
--- /dev/null
+++ b/cds-ui/server/src/datasources/db.datasource.ts
@@ -0,0 +1,36 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+import {inject} from '@loopback/core';
+import {juggler} from '@loopback/repository';
+import * as config from './db.datasource.json';
+
+export class DbDataSource extends juggler.DataSource {
+ static dataSourceName = 'db';
+
+ constructor(
+ @inject('datasources.config.db', {optional: true})
+ dsConfig: object = config,
+ ) {
+ super(dsConfig);
+ }
+}
diff --git a/cds-ui/server/src/datasources/index.ts b/cds-ui/server/src/datasources/index.ts
new file mode 100644
index 000000000..1726b4515
--- /dev/null
+++ b/cds-ui/server/src/datasources/index.ts
@@ -0,0 +1,23 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+export * from './db.datasource';
diff --git a/cds-ui/server/src/datasources/rest.config.json b/cds-ui/server/src/datasources/rest.config.json
new file mode 100644
index 000000000..86f33fbd4
--- /dev/null
+++ b/cds-ui/server/src/datasources/rest.config.json
@@ -0,0 +1,39 @@
+{
+ "name": "restConfig",
+ "connector": "rest",
+ "options": {
+ "headers": {
+ "accept": "application/json",
+ "content-type": "application/json"
+ }
+ },
+ "operations": [
+ {
+ "template": {
+ "method": "GET",
+ "url": ""
+ },
+ "functions": {
+ "getEnricheddata": [""]
+ }
+ },
+ {
+ "template": {
+ "method": "POST",
+ "url": ""
+ },
+ "functions": {
+ "saveBlueprint": [""]
+ }
+ },
+ {
+ "template": {
+ "method": "POST",
+ "url": ""
+ },
+ "functions": {
+ "test": [""]
+ }
+ }
+]
+} \ No newline at end of file
diff --git a/cds-ui/server/src/datasources/rest.datasource.ts b/cds-ui/server/src/datasources/rest.datasource.ts
new file mode 100644
index 000000000..42cdb8018
--- /dev/null
+++ b/cds-ui/server/src/datasources/rest.datasource.ts
@@ -0,0 +1,32 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+import { juggler } from '@loopback/service-proxy';
+import * as config from './rest.config.json';
+
+
+export class RestDataSource extends juggler.DataSource {
+ static dataSourceName = 'rest';
+ constructor(dsConfig: object = config) {
+ super(dsConfig);
+ }
+}
diff --git a/cds-ui/server/src/index.ts b/cds-ui/server/src/index.ts
new file mode 100644
index 000000000..04852494f
--- /dev/null
+++ b/cds-ui/server/src/index.ts
@@ -0,0 +1,37 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { CdsUiServerApplication } from './application';
+import { ApplicationConfig } from '@loopback/core';
+
+export { CdsUiServerApplication };
+
+export async function main(options: ApplicationConfig = {}) {
+ const app = new CdsUiServerApplication(options);
+ await app.boot();
+ await app.start();
+
+ const url = app.restServer.url;
+ console.log(`Server is running at ${url}`);
+ console.log(`Try ${url}/ping`);
+
+ return app;
+}
diff --git a/cds-ui/server/src/migrate.ts b/cds-ui/server/src/migrate.ts
new file mode 100644
index 000000000..0897b980b
--- /dev/null
+++ b/cds-ui/server/src/migrate.ts
@@ -0,0 +1,41 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { CdsUiServerApplication } from './application';
+
+export async function migrate(args: string[]) {
+ const existingSchema = args.includes('--rebuild') ? 'drop' : 'alter';
+ console.log('Migrating schemas (%s existing schema)', existingSchema);
+
+ const app = new CdsUiServerApplication();
+ await app.boot();
+ await app.migrateSchema({ existingSchema });
+
+ // Connectors usually keep a pool of opened connections,
+ // this keeps the process running even after all work is done.
+ // We need to exit explicitly.
+ process.exit(0);
+}
+
+migrate(process.argv).catch(err => {
+ console.error('Cannot migrate database schema', err);
+ process.exit(1);
+});
diff --git a/cds-ui/server/src/models/README.md b/cds-ui/server/src/models/README.md
new file mode 100644
index 000000000..b4bbe4ac0
--- /dev/null
+++ b/cds-ui/server/src/models/README.md
@@ -0,0 +1,24 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+# Models
+
+This directory contains code for models provided by this app.
diff --git a/cds-ui/server/src/models/blueprint.model.ts b/cds-ui/server/src/models/blueprint.model.ts
new file mode 100644
index 000000000..d9fe1a84a
--- /dev/null
+++ b/cds-ui/server/src/models/blueprint.model.ts
@@ -0,0 +1,52 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+import {Entity, model, property} from '@loopback/repository';
+
+@model()
+export class Blueprint extends Entity {
+ @property({
+ type: 'number',
+ id: true,
+ })
+ id?: number;
+
+ @property({
+ type: 'object',
+ })
+ metadata?: object;
+
+ @property({
+ type: 'array',
+ itemType: 'object',
+ })
+ fileImports?: object[];
+
+ @property({
+ type: 'object',
+ })
+ topologyTemplates?: object;
+
+ constructor(data?: Partial<Blueprint>) {
+ super(data);
+ }
+}
diff --git a/cds-ui/server/src/models/index.ts b/cds-ui/server/src/models/index.ts
new file mode 100644
index 000000000..b4de6a58c
--- /dev/null
+++ b/cds-ui/server/src/models/index.ts
@@ -0,0 +1,23 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+export * from './blueprint.model';
diff --git a/cds-ui/server/src/repositories/README.md b/cds-ui/server/src/repositories/README.md
new file mode 100644
index 000000000..dc7af9055
--- /dev/null
+++ b/cds-ui/server/src/repositories/README.md
@@ -0,0 +1,24 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+# Repositories
+
+This directory contains code for repositories provided by this app.
diff --git a/cds-ui/server/src/repositories/blueprint.repository.ts b/cds-ui/server/src/repositories/blueprint.repository.ts
new file mode 100644
index 000000000..3af5c1163
--- /dev/null
+++ b/cds-ui/server/src/repositories/blueprint.repository.ts
@@ -0,0 +1,37 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+import {DefaultCrudRepository, juggler} from '@loopback/repository';
+import {Blueprint} from '../models';
+import {DbDataSource} from '../datasources';
+import {inject} from '@loopback/core';
+
+export class BlueprintRepository extends DefaultCrudRepository<
+ Blueprint,
+ typeof Blueprint.prototype.id
+> {
+ constructor(
+ @inject('datasources.db') dataSource: DbDataSource,
+ ) {
+ super(Blueprint, dataSource);
+ }
+}
diff --git a/cds-ui/server/src/repositories/index.ts b/cds-ui/server/src/repositories/index.ts
new file mode 100644
index 000000000..ac56b3c14
--- /dev/null
+++ b/cds-ui/server/src/repositories/index.ts
@@ -0,0 +1,23 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+
+export * from './blueprint.repository';
diff --git a/cds-ui/server/src/sequence.ts b/cds-ui/server/src/sequence.ts
new file mode 100644
index 000000000..b27093147
--- /dev/null
+++ b/cds-ui/server/src/sequence.ts
@@ -0,0 +1,56 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import { inject } from '@loopback/context';
+import {
+ FindRoute,
+ InvokeMethod,
+ ParseParams,
+ Reject,
+ RequestContext,
+ RestBindings,
+ Send,
+ SequenceHandler,
+} from '@loopback/rest';
+
+const SequenceActions = RestBindings.SequenceActions;
+
+export class MySequence implements SequenceHandler {
+ constructor(
+ @inject(SequenceActions.FIND_ROUTE) protected findRoute: FindRoute,
+ @inject(SequenceActions.PARSE_PARAMS) protected parseParams: ParseParams,
+ @inject(SequenceActions.INVOKE_METHOD) protected invoke: InvokeMethod,
+ @inject(SequenceActions.SEND) public send: Send,
+ @inject(SequenceActions.REJECT) public reject: Reject,
+ ) { }
+
+ async handle(context: RequestContext) {
+ try {
+ const { request, response } = context;
+ const route = this.findRoute(request);
+ const args = await this.parseParams(request, route);
+ const result = await this.invoke(route, args);
+ this.send(response, result);
+ } catch (err) {
+ this.reject(context, err);
+ }
+ }
+}
diff --git a/cds-ui/server/src/services/rest.service.ts b/cds-ui/server/src/services/rest.service.ts
new file mode 100644
index 000000000..b94ea4dd3
--- /dev/null
+++ b/cds-ui/server/src/services/rest.service.ts
@@ -0,0 +1,46 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+============LICENSE_END============================================
+*/
+
+import {getService, juggler} from '@loopback/service-proxy';
+import {inject, Provider} from '@loopback/core';
+import {RestDataSource} from '../datasources/rest.datasource';
+
+
+export interface RestResponseData {
+ userId: number;
+ id: number;
+ title: string;
+ completed: boolean;
+}
+
+export interface RestService {
+ getrestdata(id?: number): Promise<RestResponseData>;
+}
+export class RestProvider implements Provider<RestService> {
+ constructor(
+ @inject('datasources.rest')
+ protected dataSource: juggler.DataSource = new RestDataSource(),
+ ) {}
+
+ value(): Promise<RestService> {
+ return getService(this.dataSource);
+ }
+} \ No newline at end of file