diff --git a/src/cli.ts b/src/cli.ts
index f412138c..76ce2fe3 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -17,10 +17,11 @@ import * as commander from 'commander';
import {readFileSync} from 'fs';
import {join} from 'path';
import {executeConnector, isValidSCNamespace} from './common';
-import {MinimalConnector} from './MinimalConnector';
+import {MinimalConnector} from './minimal-connector';
const connectorVersion = JSON.parse(
- readFileSync(join(__dirname, '..', 'package.json')).toString(),
+ readFileSync(join(__dirname, '..', 'package.json'))
+ .toString(),
).version;
process.on('unhandledRejection', (error) => {
diff --git a/src/common.ts b/src/common.ts
index e8481428..f51d799f 100644
--- a/src/common.ts
+++ b/src/common.ts
@@ -12,14 +12,14 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {ConnectorClient} from '@openstapps/api/lib/connectorClient';
-import {HttpClient} from '@openstapps/api/lib/httpClient';
+import {ConnectorClient} from '@openstapps/api/lib/connector-client';
+import {HttpClient} from '@openstapps/api/lib/http-client';
import {
SCLicensePlate,
SCNamespaces,
SCThings,
} from '@openstapps/core';
-import {Connector} from './Connector';
+import {Connector} from './connector';
/**
* Checks if the input is a valid SCNamespace
@@ -27,7 +27,8 @@ import {Connector} from './Connector';
* @param input Name of the potential SCNamespace
*/
export function isValidSCNamespace(input: string): input is SCLicensePlate {
- return Object.keys(SCNamespaces).indexOf(input) > 0;
+ return Object.keys(SCNamespaces)
+ .indexOf(input) > 0;
}
/**
@@ -38,7 +39,7 @@ export function isValidSCNamespace(input: string): input is SCLicensePlate {
* @param itemIdentifier Identifying representation of the item
* @param licensePlate License plate of the school
*/
-export function createUUID(itemIdentifier: any, licensePlate: SCLicensePlate): string {
+export function createUUID(itemIdentifier: unknown, licensePlate: SCLicensePlate): string {
return ConnectorClient.makeUUID(JSON.stringify(itemIdentifier), licensePlate);
}
diff --git a/src/Connector.ts b/src/connector.ts
similarity index 100%
rename from src/Connector.ts
rename to src/connector.ts
diff --git a/src/MinimalConnector.ts b/src/minimal-connector.ts
similarity index 87%
rename from src/MinimalConnector.ts
rename to src/minimal-connector.ts
index cd69a0b2..94835b99 100644
--- a/src/MinimalConnector.ts
+++ b/src/minimal-connector.ts
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018, 2019 StApps
+ * Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -14,14 +14,16 @@
*/
import {SCLicensePlate, SCMessage, SCThingRemoteOrigin, SCThingType} from '@openstapps/core';
import {createUUID} from './common';
-import {Connector} from './Connector';
+import {Connector} from './connector';
/**
* Example connector
*/
export class MinimalConnector extends Connector {
- // for quick access to the type
- private type: SCThingType.Message = SCThingType.Message;
+ /**
+ * Type of the things handled in the connector for quick access to the type
+ */
+ private readonly type: SCThingType.Message = SCThingType.Message;
/**
* Constructor for the MinimalConnector
@@ -40,6 +42,7 @@ export class MinimalConnector extends Connector {
const customRemoteOrigin = this.createRemoteOrigin();
// may add a maintainer or other attributes here
customRemoteOrigin.url = 'http://your.backend.url';
+
return customRemoteOrigin;
}
@@ -51,7 +54,7 @@ export class MinimalConnector extends Connector {
{
audiences: ['students', 'employees'],
description: 'Some description 1',
- message: 'Some message 1',
+ messageBody: 'Some message 1',
name: 'Some name 1',
origin: this.createCustomRemoteOrigin(),
type: this.type,
@@ -60,7 +63,7 @@ export class MinimalConnector extends Connector {
{
audiences: ['students', 'employees'],
description: 'Some description 2',
- message: 'Some message 2',
+ messageBody: 'Some message 2',
name: 'Some name 2',
origin: this.createCustomRemoteOrigin(),
type: this.type,
@@ -69,13 +72,14 @@ export class MinimalConnector extends Connector {
{
audiences: ['students', 'employees'],
description: 'Some description 3',
- message: 'Some message 3',
+ messageBody: 'Some message 3',
name: 'Some name 3',
origin: this.createCustomRemoteOrigin(),
type: this.type,
uid: createUUID({id: 'message_3'}, this.licensePlate),
},
];
+
return importedItems;
}
}
diff --git a/test/common.spec.ts b/test/common.spec.ts
index fc2ab0cb..6760fc6f 100644
--- a/test/common.spec.ts
+++ b/test/common.spec.ts
@@ -15,7 +15,7 @@
import {SCThingType, SCBulkResponse, SCLicensePlate} from '@openstapps/core';
import {expect} from 'chai';
import {suite, test} from 'mocha-typescript';
-import {MinimalConnector} from '../src/MinimalConnector';
+import {MinimalConnector} from '../src/minimal-connector';
import {createUUID, executeConnector, isValidSCNamespace} from '../src/common';
import nock = require('nock');
diff --git a/test/Connector.spec.ts b/test/connector.spec.ts
similarity index 96%
rename from test/Connector.spec.ts
rename to test/connector.spec.ts
index fd499ba9..319f6395 100644
--- a/test/Connector.spec.ts
+++ b/test/connector.spec.ts
@@ -15,7 +15,7 @@
import {SCThingOriginType} from '@openstapps/core';
import {expect} from 'chai';
import {suite, test} from 'mocha-typescript';
-import {MinimalConnector} from '../src/MinimalConnector';
+import {MinimalConnector} from '../src/minimal-connector';
@suite
export class ConnectorSpec {
diff --git a/test/MinimalConnector.spec.ts b/test/minimal-connector.spec.ts
similarity index 97%
rename from test/MinimalConnector.spec.ts
rename to test/minimal-connector.spec.ts
index 387cac30..4b102b9c 100644
--- a/test/MinimalConnector.spec.ts
+++ b/test/minimal-connector.spec.ts
@@ -17,7 +17,7 @@ import {Validator} from '@openstapps/core-tools/lib/validate';
import {expect} from 'chai';
import {suite, test} from 'mocha-typescript';
import {join} from 'path';
-import {MinimalConnector} from '../src/MinimalConnector';
+import {MinimalConnector} from '../src/minimal-connector';
@suite
export class MinimalConnectorSpec {