mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fae7395cf0 | ||
|
|
0745b1af72 | ||
|
|
a2b2cefe8e | ||
|
|
04b21a7c5d | ||
|
|
ca7626db17 | ||
|
|
e8d492a18a | ||
|
|
aa294c4e29 | ||
|
|
369bb906c1 | ||
|
|
aa38fef293 | ||
|
|
ded8e7dfd5 | ||
|
|
d47897c7e8 |
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,3 +1,25 @@
|
|||||||
|
# [0.52.0](https://gitlab.com/openstapps/core/compare/v0.51.0...v0.52.0) (2021-09-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add about config ([aa294c4](https://gitlab.com/openstapps/core/commit/aa294c4e29e9191bef6d79487b0b321fbc34f6fb))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.51.0](https://gitlab.com/openstapps/core/compare/v0.50.0...v0.51.0) (2021-09-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add physicalobject to book categories ([ded8e7d](https://gitlab.com/openstapps/core/commit/ded8e7dfd51094c02a86e1383a4e94c069c10e64))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [0.50.0](https://gitlab.com/openstapps/core/compare/v0.49.5...v0.50.0) (2021-09-01)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.49.5](https://gitlab.com/openstapps/core/compare/v0.49.3...v0.49.5) (2021-08-27)
|
## [0.49.5](https://gitlab.com/openstapps/core/compare/v0.49.3...v0.49.5) (2021-08-27)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.50.0",
|
"version": "0.53.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@openstapps/core",
|
"name": "@openstapps/core",
|
||||||
"version": "0.50.0",
|
"version": "0.53.0",
|
||||||
"description": "StAppsCore - Generalized model of data",
|
"description": "StAppsCore - Generalized model of data",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Model",
|
"Model",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
// tslint:disable-next-line:no-implicit-dependencies
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import {Polygon} from 'geojson';
|
import {Polygon} from 'geojson';
|
||||||
import {SCTranslations} from '../general/i18n';
|
import {SCTranslations} from '../general/i18n';
|
||||||
|
import {SCMap} from '../general/map';
|
||||||
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
|
import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +81,13 @@ export interface SCAppConfigurationMenuCategory {
|
|||||||
* An app configuration
|
* An app configuration
|
||||||
*/
|
*/
|
||||||
export interface SCAppConfiguration {
|
export interface SCAppConfiguration {
|
||||||
|
/**
|
||||||
|
* The about page
|
||||||
|
*
|
||||||
|
* Mapping route -> page config
|
||||||
|
*/
|
||||||
|
aboutPages: SCMap<SCAboutPage>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Polygon that encapsulates the main campus
|
* Polygon that encapsulates the main campus
|
||||||
*/
|
*/
|
||||||
@@ -174,3 +182,147 @@ export interface SCAppConfigurationMenuCategoryTranslationName {
|
|||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum SCAboutPageContentType {
|
||||||
|
SECTION = 'section',
|
||||||
|
ROUTER_LINK = 'router link',
|
||||||
|
TABLE = 'table',
|
||||||
|
MARKDOWN = 'markdown',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SCAboutPageTranslationTitle {
|
||||||
|
/**
|
||||||
|
* Translation of the title
|
||||||
|
*/
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SCAboutPageTranslationValue {
|
||||||
|
/**
|
||||||
|
* Translation of the value
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A (mostly) self-contained section, akin to markdown `# Title`
|
||||||
|
*/
|
||||||
|
export interface SCAboutPageSection {
|
||||||
|
/**
|
||||||
|
* If the section should be contained in a card
|
||||||
|
*/
|
||||||
|
card?: true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The content of the section
|
||||||
|
*/
|
||||||
|
content: SCAboutPageContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title of the section
|
||||||
|
*/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations
|
||||||
|
*/
|
||||||
|
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*/
|
||||||
|
type: SCAboutPageContentType.SECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A router link that can lead to a new page
|
||||||
|
*
|
||||||
|
* For external links, prefer markdown `[destination](link)`
|
||||||
|
*/
|
||||||
|
export interface SCAboutPageRouterLink {
|
||||||
|
/**
|
||||||
|
* Icon of the destination
|
||||||
|
*/
|
||||||
|
icon?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router link
|
||||||
|
*/
|
||||||
|
link: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title of the destination
|
||||||
|
*/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations
|
||||||
|
*/
|
||||||
|
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*/
|
||||||
|
type: SCAboutPageContentType.ROUTER_LINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple table element
|
||||||
|
*/
|
||||||
|
export interface SCAboutPageTable {
|
||||||
|
/**
|
||||||
|
* Rows of the table
|
||||||
|
*/
|
||||||
|
rows: SCAboutPageContent[][];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*/
|
||||||
|
type: SCAboutPageContentType.TABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A markdown element
|
||||||
|
*/
|
||||||
|
export interface SCAboutPageMarkdown {
|
||||||
|
/**
|
||||||
|
* Translations
|
||||||
|
*/
|
||||||
|
translations: SCTranslations<SCAboutPageTranslationValue>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type
|
||||||
|
*/
|
||||||
|
type: SCAboutPageContentType.MARKDOWN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value (Markdown)
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SCAboutPageContent =
|
||||||
|
| SCAboutPageMarkdown
|
||||||
|
| SCAboutPageTable
|
||||||
|
| SCAboutPageSection
|
||||||
|
| SCAboutPageRouterLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Root of the about page
|
||||||
|
*/
|
||||||
|
export interface SCAboutPage {
|
||||||
|
/**
|
||||||
|
* Content of the page
|
||||||
|
*/
|
||||||
|
content: SCAboutPageContent[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Header (title) of the page
|
||||||
|
*/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translations
|
||||||
|
*/
|
||||||
|
translations: SCTranslations<SCAboutPageTranslationTitle>;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {BAD_GATEWAY} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ export class SCInternalServerErrorResponse extends SCError {
|
|||||||
* and the internal server error should be displayed to the client
|
* and the internal server error should be displayed to the client
|
||||||
*/
|
*/
|
||||||
constructor(err?: Error, stack = false) {
|
constructor(err?: Error, stack = false) {
|
||||||
super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
|
super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack);
|
||||||
|
|
||||||
if (stack) {
|
if (stack) {
|
||||||
this.additionalData = err;
|
this.additionalData = err;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {METHOD_NOT_ALLOWED} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,6 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
|
super('MethodNotAllowedError', 'HTTP method is not allowed on this route', StatusCodes.METHOD_NOT_ALLOWED, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {NOT_FOUND} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,6 @@ export class SCNotFoundErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
|
super('NotFoundError', 'Resource not found', StatusCodes.NOT_FOUND, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {NOT_ACCEPTABLE} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +29,6 @@ export class SCParametersNotAcceptable extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
|
super('ParametersNotAcceptable', message, StatusCodes.NOT_ACCEPTABLE, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {CONFLICT} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
import {SCPluginMetaData} from '../routes/plugin-register';
|
import {SCPluginMetaData} from '../routes/plugin-register';
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
|
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
|
||||||
super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
|
super('SCPluginAlreadyRegisteredError', message, StatusCodes.CONFLICT, stack);
|
||||||
if (stack) {
|
if (stack) {
|
||||||
this.additionalData = plugin;
|
this.additionalData = plugin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {INTERNAL_SERVER_ERROR} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +28,6 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
|
super('PluginRegisteringFailedError', message, StatusCodes.INTERNAL_SERVER_ERROR, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {REQUEST_TOO_LONG} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,6 @@ export class SCRequestBodyTooLargeErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
|
super('RequestBodyTooLargeError', 'The request body is too large.', StatusCodes.REQUEST_TOO_LONG, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {BAD_REQUEST} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned whenever there is a syntax error
|
* An error that is returned whenever there is a syntax error
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCSyntaxErrorResponse extends SCError {
|
export class SCSyntaxErrorResponse extends SCError {
|
||||||
@@ -28,6 +28,6 @@ export class SCSyntaxErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(message: string, stack?: boolean) {
|
constructor(message: string, stack?: boolean) {
|
||||||
super('SyntaxError', message, BAD_REQUEST, stack);
|
super('SyntaxError', message, StatusCodes.BAD_REQUEST, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {TOO_MANY_REQUESTS} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An error that is returned, when to many request are submitted at once
|
* An error that is returned, when to many request are submitted at once
|
||||||
*
|
*
|
||||||
* @validatable
|
* @validatable
|
||||||
*/
|
*/
|
||||||
export class SCTooManyRequestsErrorResponse extends SCError {
|
export class SCTooManyRequestsErrorResponse extends SCError {
|
||||||
@@ -30,7 +30,7 @@ export class SCTooManyRequestsErrorResponse extends SCError {
|
|||||||
super(
|
super(
|
||||||
'TooManyRequestsError',
|
'TooManyRequestsError',
|
||||||
'Too many requests. You can not submit more than 5 queries an once',
|
'Too many requests. You can not submit more than 5 queries an once',
|
||||||
TOO_MANY_REQUESTS,
|
StatusCodes.TOO_MANY_REQUESTS,
|
||||||
stack,
|
stack,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {UNSUPPORTED_MEDIA_TYPE} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,6 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(stack?: boolean) {
|
constructor(stack?: boolean) {
|
||||||
super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
|
super('UnsupportedMediaTypeError', 'Unsupported media type', StatusCodes.UNSUPPORTED_MEDIA_TYPE, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {ValidationError} from '@openstapps/core-tools/lib/types/validator';
|
import {ValidationError} from '@openstapps/core-tools/lib/types/validator';
|
||||||
import {BAD_REQUEST} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCError} from '../error';
|
import {SCError} from '../error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ export class SCValidationErrorResponse extends SCError {
|
|||||||
* @param stack Set to true if a stack trace should be created
|
* @param stack Set to true if a stack trace should be created
|
||||||
*/
|
*/
|
||||||
constructor(errors: ValidationError[], stack?: boolean) {
|
constructor(errors: ValidationError[], stack?: boolean) {
|
||||||
super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
|
super('ValidationError', 'Validation of request failed', StatusCodes.BAD_REQUEST, stack);
|
||||||
this.additionalData = errors;
|
this.additionalData = errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCUuid} from '../../general/uuid';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
|
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
@@ -88,7 +88,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/bookAvailability';
|
this.urlFragment = '/bookAvailability';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {CREATED} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCThings} from '../../meta';
|
import {SCThings} from '../../meta';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
@@ -59,7 +59,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkAddRequest';
|
this.requestBodyName = 'SCBulkAddRequest';
|
||||||
this.responseBodyName = 'SCBulkAddResponse';
|
this.responseBodyName = 'SCBulkAddResponse';
|
||||||
this.statusCodeSuccess = CREATED;
|
this.statusCodeSuccess = StatusCodes.CREATED;
|
||||||
this.urlFragment = '/bulk/:UID';
|
this.urlFragment = '/bulk/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {NO_CONTENT} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
import {SCNotFoundErrorResponse} from '../errors/not-found';
|
||||||
@@ -59,7 +59,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCBulkDoneRequest';
|
this.requestBodyName = 'SCBulkDoneRequest';
|
||||||
this.responseBodyName = 'SCBulkDoneResponse';
|
this.responseBodyName = 'SCBulkDoneResponse';
|
||||||
this.statusCodeSuccess = NO_CONTENT;
|
this.statusCodeSuccess = StatusCodes.NO_CONTENT;
|
||||||
this.urlFragment = '/bulk/:UID/done';
|
this.urlFragment = '/bulk/:UID/done';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCISO8601Date} from '../../general/time';
|
import {SCISO8601Date} from '../../general/time';
|
||||||
import {SCUuid} from '../../general/uuid';
|
import {SCUuid} from '../../general/uuid';
|
||||||
import {SCThingType} from '../../things/abstract/thing';
|
import {SCThingType} from '../../things/abstract/thing';
|
||||||
@@ -98,7 +98,7 @@ export class SCBulkRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCBulkRequest';
|
this.requestBodyName = 'SCBulkRequest';
|
||||||
this.responseBodyName = 'SCBulkResponse';
|
this.responseBodyName = 'SCBulkResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/bulk';
|
this.urlFragment = '/bulk';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {NO_CONTENT} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCMessage} from '../../things/message';
|
import {SCMessage} from '../../things/message';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
@@ -59,7 +59,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCFeedbackRequest';
|
this.requestBodyName = 'SCFeedbackRequest';
|
||||||
this.responseBodyName = 'SCFeedbackResponse';
|
this.responseBodyName = 'SCFeedbackResponse';
|
||||||
this.statusCodeSuccess = NO_CONTENT;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/feedback';
|
this.urlFragment = '/feedback';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCAppConfiguration} from '../../config/app';
|
import {SCAppConfiguration} from '../../config/app';
|
||||||
import {SCBackendConfiguration} from '../../config/backend';
|
import {SCBackendConfiguration} from '../../config/backend';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
@@ -65,7 +65,7 @@ export class SCIndexRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCIndexRequest';
|
this.requestBodyName = 'SCIndexRequest';
|
||||||
this.responseBodyName = 'SCIndexResponse';
|
this.responseBodyName = 'SCIndexResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/';
|
this.urlFragment = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {JSONSchema7} from 'json-schema';
|
import {JSONSchema7} from 'json-schema';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
@@ -122,7 +122,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/plugin/register';
|
this.urlFragment = '/plugin/register';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCMap} from '../../general/map';
|
import {SCMap} from '../../general/map';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
@@ -63,7 +63,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCMultiSearchRequest';
|
this.requestBodyName = 'SCMultiSearchRequest';
|
||||||
this.responseBodyName = 'SCMultiSearchResponse';
|
this.responseBodyName = 'SCMultiSearchResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/search/multi';
|
this.urlFragment = '/search/multi';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
|
||||||
@@ -56,7 +56,7 @@ export class SCSearchRoute extends SCAbstractRoute {
|
|||||||
this.method = SCRouteHttpVerbs.POST;
|
this.method = SCRouteHttpVerbs.POST;
|
||||||
this.requestBodyName = 'SCSearchRequest';
|
this.requestBodyName = 'SCSearchRequest';
|
||||||
this.responseBodyName = 'SCSearchResponse';
|
this.responseBodyName = 'SCSearchResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/search';
|
this.urlFragment = '/search';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {OK} from 'http-status-codes';
|
import {StatusCodes} from 'http-status-codes';
|
||||||
import {SCThings} from '../../meta';
|
import {SCThings} from '../../meta';
|
||||||
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
|
||||||
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
|
||||||
@@ -60,7 +60,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
|||||||
};
|
};
|
||||||
this.requestBodyName = 'SCThingUpdateRequest';
|
this.requestBodyName = 'SCThingUpdateRequest';
|
||||||
this.responseBodyName = 'SCThingUpdateResponse';
|
this.responseBodyName = 'SCThingUpdateResponse';
|
||||||
this.statusCodeSuccess = OK;
|
this.statusCodeSuccess = StatusCodes.OK;
|
||||||
this.urlFragment = '/:TYPE/:UID';
|
this.urlFragment = '/:TYPE/:UID';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export type SCBookCategories = 'audio'
|
|||||||
| 'microfilm'
|
| 'microfilm'
|
||||||
| 'musicalscore'
|
| 'musicalscore'
|
||||||
| 'photo'
|
| 'photo'
|
||||||
|
| 'physicalobject'
|
||||||
| 'retro'
|
| 'retro'
|
||||||
| 'sensorimage'
|
| 'sensorimage'
|
||||||
| 'unknown'
|
| 'unknown'
|
||||||
|
|||||||
44
test/compat.spec.ts
Normal file
44
test/compat.spec.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 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.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {lightweightProjectFromPath} from '@openstapps/core-tools/lib/easy-ast/easy-ast';
|
||||||
|
import {LightweightProject} from '@openstapps/core-tools/lib/easy-ast/types/lightweight-project';
|
||||||
|
import {expect} from 'chai';
|
||||||
|
import {reduce} from 'lodash';
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (err) => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Mapping Compatibility', () => {
|
||||||
|
let project: LightweightProject;
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
this.slow(10000);
|
||||||
|
|
||||||
|
project = lightweightProjectFromPath('src');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('non-exported definitions should not have duplicate names across files', () => {
|
||||||
|
reduce(project, (result, file) => reduce(file, (result2, _, key) => {
|
||||||
|
expect(result2[key]).to.be.undefined;
|
||||||
|
return {
|
||||||
|
[key]: true,
|
||||||
|
...result2,
|
||||||
|
};
|
||||||
|
}, result), {} as Record<string, boolean>);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user