Compare commits
21 Commits
@openstapp
...
114-improv
| Author | SHA1 | Date | |
|---|---|---|---|
|
e4b29cad73
|
|||
|
8cfedd7aa1
|
|||
|
10e3b21ad4
|
|||
|
0a5cf19b8a
|
|||
|
4833155721
|
|||
|
d3fe9a2f85
|
|||
|
6dc01b538c
|
|||
|
fdec5a5baa
|
|||
|
51602ffa0f
|
|||
|
8a421cb2fb
|
|||
|
9ef77ab3ed
|
|||
|
4e181f881b
|
|||
|
780916eb35
|
|||
|
62d5ea4275
|
|||
|
4bdd4b20d0
|
|||
|
c7555e1918
|
|||
|
d18a579cb8
|
|||
|
0de613969e
|
|||
|
8466976b3c
|
|||
|
f65fb52def
|
|||
|
c6ab4ae48b
|
7
.changeset/few-pots-clean.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@openstapps/backend': minor
|
||||
'@openstapps/core': minor
|
||||
'@openstapps/app': minor
|
||||
---
|
||||
|
||||
Add job portal feature
|
||||
5
.changeset/gorgeous-parrots-bow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@openstapps/api-cli': minor
|
||||
---
|
||||
|
||||
Add "\*" option to copy command that allows for a full database clone
|
||||
2
.gitignore
vendored
@@ -51,6 +51,8 @@ node_modules/
|
||||
.pnpm-store/
|
||||
jspm_packages/
|
||||
|
||||
.browser-data
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extension": ["ts"],
|
||||
"extension": ["ts", "js"],
|
||||
"node-option": ["loader=ts-node/esm"],
|
||||
"reporter": "mocha-junit-reporter",
|
||||
"reporter-option": ["mochaFile=coverage/report-junit.xml"],
|
||||
"spec": ["test/**/*.spec.ts"]
|
||||
"spec": ["test/**/*.spec.{ts,js}"]
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
pnpm-lock.yaml
|
||||
@@ -40,12 +40,6 @@ const config = {
|
||||
packages: ['**'],
|
||||
isIgnored: true,
|
||||
},
|
||||
{
|
||||
label: 'ES Mapping Generator Special Dependencies',
|
||||
dependencies: ['typescript', 'typedoc', 'ts-node', '@types/node', 'got'],
|
||||
packages: ['@openstapps/es-mapping-generator'],
|
||||
isIgnored: true,
|
||||
},
|
||||
{
|
||||
label: 'Packages should use workspace version',
|
||||
dependencies: ['@openstapps/**'],
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
# @openstapps/backend
|
||||
|
||||
## 3.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix backend rejecting plugins
|
||||
- Fix backend sliently falling back to default configs
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix version history offered by backend
|
||||
- Updated dependencies
|
||||
- @openstapps/core@3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8ca10: Add job portal feature
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8ca10]
|
||||
- @openstapps/core@3.1.0
|
||||
|
||||
## 3.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -22,7 +22,6 @@ const app = {
|
||||
name: 'Goethe-Uni',
|
||||
privacyPolicyUrl: 'https://mobile.server.uni-frankfurt.de/_static/privacy.md',
|
||||
settings: [userGroupSetting, languageSetting],
|
||||
versionHistory: [],
|
||||
};
|
||||
|
||||
export default app;
|
||||
|
||||
@@ -17,7 +17,7 @@ export const backend = {
|
||||
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
|
||||
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
|
||||
maxMultiSearchRouteQueries: 5,
|
||||
maxRequestBodySize: 2 * 10 ** 6,
|
||||
maxRequestBodySize: 512 * 1024,
|
||||
name: 'Goethe-Universität Frankfurt am Main',
|
||||
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
||||
sortableFields: [
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
*
|
||||
* To get more information about the meaning of specific fields, please use your IDE to read the TSDoc documentation.
|
||||
*
|
||||
* @type {import('../../src/storage/elasticsearch/types/elasticsearch-config.js').ElasticsearchConfigFile}
|
||||
* @type {import('../../src/storage/elasticsearch/types/elasticsearch-config.js')}
|
||||
*/
|
||||
const config = {
|
||||
internal: {
|
||||
database: {
|
||||
name: 'elasticsearch',
|
||||
version: '8.4.2',
|
||||
version: '5.6',
|
||||
query: {
|
||||
minMatch: '75%',
|
||||
queryType: 'dis_max',
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// @ts-check
|
||||
import {readFile, readdir} from 'fs/promises';
|
||||
import url from 'url';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* @example version(1, import.meta.url)
|
||||
* @param options {Omit<import('@openstapps/core').SCAppVersionInfo, 'releaseNotes' | 'translations'>}
|
||||
* @param base {string}
|
||||
* @returns {Promise<import('@openstapps/core').SCAppVersionInfo>}
|
||||
*/
|
||||
export async function version(options, base) {
|
||||
const de = await readFile(new URL(`${options.version}.de.md`, base), 'utf8');
|
||||
const en = await readFile(new URL(`${options.version}.en.md`, base), 'utf8');
|
||||
|
||||
return {
|
||||
...options,
|
||||
releaseNotes: de,
|
||||
translations: {
|
||||
en: {
|
||||
releaseNotes: en,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param base {string} Base path of the file as `import.meta.url`
|
||||
* @returns {Promise<import('@openstapps/core').SCAppVersionInfo[]>}
|
||||
*/
|
||||
export async function versions(base) {
|
||||
const directory = await readdir(path.dirname(url.fileURLToPath(base)));
|
||||
const versions = [
|
||||
...new Set(directory.filter(it => it.endsWith('.md')).map(it => it.replace(/\.\w+\.md$/, ''))),
|
||||
].sort((a, b) => -a.localeCompare(b, undefined, {numeric: true}));
|
||||
|
||||
return Promise.all(versions.map(versionName => version({version: versionName}, base)));
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import about from './about.js';
|
||||
import imprint from './imprint.js';
|
||||
import privacy from './privacy.js';
|
||||
|
||||
/** @type {import('@openstapps/core').SCMap<import('@openstapps/core').SCAboutPage>} */
|
||||
/** @type {Record<string, import('@openstapps/core').SCAboutPage>} */
|
||||
const aboutPages = {
|
||||
'about': about,
|
||||
'about/imprint': imprint,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import aboutPages from './about-pages/index.js';
|
||||
import defaultApp from '../default/app/index.js';
|
||||
import {backend as defaultBackend, internal as defaultInternal} from '../default/backend/index.js';
|
||||
import versionHistory from './version-history/index.js';
|
||||
|
||||
/**
|
||||
* This is the default configuration for the Goethe university of Frankfurt
|
||||
@@ -77,7 +76,6 @@ const config = {
|
||||
} */
|
||||
},
|
||||
},
|
||||
versionHistory,
|
||||
aboutPages,
|
||||
},
|
||||
backend: defaultBackend,
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
# Goethe-Uni App 2.4
|
||||
|
||||
Wir freuen uns euch mehr in der Goethe-Uni App
|
||||
bieten zu können.
|
||||
|
||||
## Navigation zu Gebäuden und Orten
|
||||
|
||||
Als eines der Ergebnisse des Ideenwettbewerbs wurde jetzt
|
||||
ein Navigationsfeature in die App integriert.
|
||||
|
||||
Orte auf der Karte, Mensen, sowie sogar Termine (wenn hinterlegt)
|
||||
bieten jetzt direkt die Option eine Verbindung zu finden, gestützt
|
||||
durch die Karten App auf deinem Gerät.
|
||||
|
||||
## Integration der Jobbörse
|
||||
|
||||
Jobs findest du ab sofort auch in der Goethe-Uni App.
|
||||
|
||||
Auch das ist ein Ergebnis des Ideenwettbewerbs,
|
||||
und wir freuen uns es euch hier präsentieren zu können!
|
||||
|
||||
## Der Umweltscore
|
||||
|
||||
Der Umweltscore für Gerichte wird nun auch in der App angezeigt.
|
||||
|
||||
> Nachhaltigkeit, Umweltschutz, Gesundheit und Klimawandel sind
|
||||
> zentrale Begriffe im gesellschaftlichen Miteinander.
|
||||
> Unsere Ernährung spielt hierbei eine wichtige Rolle.
|
||||
> Das Studierendenwerk Frankfurt am Main zeichnet seine Speisenpläne
|
||||
> ab sofort mit einem Umweltscore aus.
|
||||
> Anhand dieser Bewertung können Sie direkt ersehen,
|
||||
> welchen Einfluss Ihre Essenauswahl auf das Klima hat.
|
||||
|
||||
## Weitere Verbesserungen
|
||||
|
||||
### Performance
|
||||
|
||||
Die Performance der App beim Navigieren wurde stark verbessert und ist datensparender.
|
||||
|
||||
### Kalender
|
||||
|
||||
Die Kalenderabschnitte haben jetzt neue Namen bekommen:
|
||||
|
||||
- Der _Kalender_ zeigt Termine für spezifische Tage
|
||||
- Die _Wochenübersicht_ ist ein Stundenplan mit allen Termine, die sich wiederholen (z. B. Vorlesungen)
|
||||
- Die _Einzeltermine_ zeigen alle Termine, die sich nicht wiederholen
|
||||
(z. B. Klausuren)
|
||||
|
||||
### Meine App
|
||||
|
||||
Der "Meine Kurse" Abschnitt wurde überarbeitet, und zeigt jetzt Termine
|
||||
für die nächsten Tage und mit mehr Details an.
|
||||
@@ -1,49 +0,0 @@
|
||||
# Goethe-Uni App 2.4
|
||||
|
||||
The Goethe-Uni App got even better!
|
||||
|
||||
## Navigation to buildings and places
|
||||
|
||||
As part of the "Ideenwettbewerb," the idea competition,
|
||||
we have now integrated a navigation feature into the app.
|
||||
|
||||
Orte auf der Karte, Mensen, sowie sogar Termine (wenn hinterlegt)
|
||||
bieten jetzt direkt die Option eine Verbindung zu finden, gestützt
|
||||
durch die Karten App auf deinem Gerät.
|
||||
|
||||
## Integration of the job market
|
||||
|
||||
Jobs are now also available in the Goethe-Uni App.
|
||||
|
||||
This feature is also a result of the idea competition,
|
||||
and we're happy to be able to present it to you here!
|
||||
|
||||
## The environment score
|
||||
|
||||
The environment score for dishes is now displayed inside the app.
|
||||
|
||||
> Sustainability, environment protection, health, and climate change are
|
||||
> central topics in how we live today in our society.
|
||||
> Our eating habits play an important role in it.
|
||||
> The "Studierendenwerk Frankfurt am Main" is marking up its menus
|
||||
> from now on with the so-called "Umweltscore," the environment score.
|
||||
> Based on this rating, you can see the impact your meal choice would have on our climate.
|
||||
|
||||
## Further improvements
|
||||
|
||||
### Performance
|
||||
|
||||
The performance while navigating around the app has been heavily improved and requires less data to work.
|
||||
|
||||
### Calendar
|
||||
|
||||
The calendar sections have new names:
|
||||
|
||||
- The _calendar_ shows appointments on specific days
|
||||
- The _week overview_ is a schedule with all events that repeat (e.g. lectures)
|
||||
- The _single events_ show all appointments that don't repeat (e.g. exams)
|
||||
|
||||
### My App
|
||||
|
||||
The "my courses" section has been revamped,
|
||||
and now shows events for the next days and with more detail.
|
||||
@@ -1,7 +0,0 @@
|
||||
// @ts-check
|
||||
import {versions} from '../../default/tools/version.js';
|
||||
|
||||
/** @type {import('@openstapps/core').SCAppVersionInfo[]} */
|
||||
const versionHistory = await versions(import.meta.url);
|
||||
|
||||
export default versionHistory;
|
||||
@@ -5,18 +5,18 @@ if [ -z $GITLAB_CI ]; then
|
||||
fi
|
||||
|
||||
( STAPPS_LOG_LEVEL=31 STAPPS_EXIT_LEVEL=8 NODE_CONFIG_ENV=elasticsearch NODE_ENV=integration-test ALLOW_NO_TRANSPORT=true ES_ADDR=http://$ES_HOST:9200 node app.js ) & backend_pid=$!
|
||||
( openstapps-api e2e http://$BACKEND_HOST:3000 --reportPath coverage/integration-report-junit.xml --waiton tcp:$BACKEND_HOST:3000 --samples node_modules/@openstapps/core/test/resources/indexable ) & api_cli_pid=$!
|
||||
( e2e-connector http://$BACKEND_HOST:3000 --reportPath coverage/integration-report-junit.xml --waiton tcp:$BACKEND_HOST:3000 --samples node_modules/@openstapps/core/test/resources/indexable ) & e2e_pid=$!
|
||||
|
||||
## Check output codes
|
||||
# api-cli output defines passing the test
|
||||
# backend should not exit early
|
||||
|
||||
wait $api_cli_pid
|
||||
api_cli_exit=$?
|
||||
wait $e2e_pid
|
||||
e2e_exit=$?
|
||||
wait $backend_pid
|
||||
backend_exit=$?
|
||||
|
||||
if [ "$api_cli_exit" -eq "0" ]; then
|
||||
if [ "$e2e_exit" -eq "0" ]; then
|
||||
echo "FINISHED";
|
||||
exit;
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openstapps/backend",
|
||||
"description": "A reference implementation for a StApps backend",
|
||||
"version": "3.1.2",
|
||||
"version": "3.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "AGPL-3.0-only",
|
||||
@@ -31,7 +31,6 @@
|
||||
"build": "tsup-node",
|
||||
"build:docker": "docker build -t openstapps:backend ../../.deploy/backend",
|
||||
"deploy": "pnpm --prod --filter=@openstapps/backend deploy ../../.deploy/backend",
|
||||
"dev": "tsup --watch --onSuccess \"pnpm run start\"",
|
||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||
"lint": "tsc --noEmit && eslint --ext .ts src/",
|
||||
@@ -43,9 +42,9 @@
|
||||
"test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/elasticsearch": "8.4.0",
|
||||
"@elastic/elasticsearch": "8.10.0",
|
||||
"@openstapps/core": "workspace:*",
|
||||
"@openstapps/core-tools": "workspace:*",
|
||||
"@openstapps/core-validator": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"@types/body-parser": "1.19.2",
|
||||
"@types/cors": "2.8.13",
|
||||
@@ -56,6 +55,8 @@
|
||||
"@types/nodemailer": "6.4.7",
|
||||
"@types/promise-queue": "2.2.0",
|
||||
"@types/uuid": "8.3.4",
|
||||
"ajv": "8.12.0",
|
||||
"ajv-formats": "2.1.1",
|
||||
"body-parser": "1.20.2",
|
||||
"cors": "2.8.5",
|
||||
"cosmiconfig": "8.1.3",
|
||||
@@ -75,7 +76,7 @@
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/api-cli": "workspace:*",
|
||||
"@openstapps/e2e-connector": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
@@ -99,18 +100,8 @@
|
||||
"sinon-express-mock": "2.2.1",
|
||||
"supertest": "6.3.3",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/cli.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"target": "es2022",
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
|
||||
@@ -23,8 +23,7 @@ import {Logger} from '@openstapps/logger';
|
||||
import cors from 'cors';
|
||||
import {Express} from 'express';
|
||||
import morgan from 'morgan';
|
||||
import path from 'path';
|
||||
import {DEFAULT_TIMEOUT, isTestEnvironment, mailer, plugins, validator} from './common.js';
|
||||
import {DEFAULT_TIMEOUT, isTestEnvironment, mailer, plugins} from './common.js';
|
||||
import {getPrometheusMiddleware} from './middleware/prometheus.js';
|
||||
import {MailQueue} from './notification/mail-queue.js';
|
||||
import {bulkAddRouter} from './routes/bulk-add-route.js';
|
||||
@@ -39,7 +38,7 @@ import {virtualPluginRoute} from './routes/virtual-plugin-route.js';
|
||||
import {BulkStorage} from './storage/bulk-storage.js';
|
||||
import {DatabaseConstructor} from './storage/database.js';
|
||||
import {backendConfig} from './config.js';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {validator} from './validator.js';
|
||||
|
||||
/**
|
||||
* Configure the backend
|
||||
@@ -143,20 +142,8 @@ export async function configureApp(app: Express, databases: {[name: string]: Dat
|
||||
request.on('data', chunkGatherer).on('end', endCallback);
|
||||
});
|
||||
|
||||
// validate config file
|
||||
const directory = path.dirname(fileURLToPath(import.meta.url));
|
||||
await validator.addSchemas(
|
||||
path.join(directory, '..', 'node_modules', '@openstapps', 'core', 'lib', 'schema'),
|
||||
);
|
||||
|
||||
// validate the config file
|
||||
const configValidation = validator.validate(backendConfig, 'SCConfigFile');
|
||||
|
||||
// validation failed
|
||||
if (configValidation.errors.length > 0) {
|
||||
throw new Error(
|
||||
`Validation of config file failed. Errors were: ${JSON.stringify(configValidation.errors)}`,
|
||||
);
|
||||
if (!validator.validate(backendConfig, 'SCConfigFile')) {
|
||||
throw new Error(`Validation of config file failed. Errors were: ${JSON.stringify(validator.errors)}`);
|
||||
}
|
||||
|
||||
// check if a database name was given
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCPluginMetaData} from '@openstapps/core';
|
||||
import {Validator} from '@openstapps/core-tools';
|
||||
import {BackendTransport} from './notification/backend-transport.js';
|
||||
|
||||
/**
|
||||
@@ -22,11 +21,6 @@ import {BackendTransport} from './notification/backend-transport.js';
|
||||
*/
|
||||
export const mailer = BackendTransport.getTransportInstance();
|
||||
|
||||
/**
|
||||
* A validator instance to check if something is a valid JSON object (e.g. a request or a thing)
|
||||
*/
|
||||
export const validator = new Validator();
|
||||
|
||||
/**
|
||||
* Provides information if the backend is executed in the "test" (non-production) environment
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,6 @@ import {cosmiconfig, PublicExplorer} from 'cosmiconfig';
|
||||
import {SCConfigFile} from '@openstapps/core';
|
||||
import path from 'path';
|
||||
import deepmerge from 'deepmerge';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
|
||||
const fallbackNamespace = 'default';
|
||||
const configPath = 'config';
|
||||
@@ -24,25 +23,31 @@ function configLoader(moduleName: string): PublicExplorer {
|
||||
* Find and load a config file
|
||||
*/
|
||||
async function findConfig<T>(moduleName: string, namespace = fallbackNamespace): Promise<T> {
|
||||
const config = await configLoader(moduleName).search(path.posix.join('.', configPath, namespace));
|
||||
|
||||
if (config) {
|
||||
Logger.info(`Using ${namespace} config for ${moduleName}`);
|
||||
return config.config;
|
||||
} else {
|
||||
Logger.info(`Using ${fallbackNamespace} config for ${moduleName}`);
|
||||
return configLoader(moduleName)
|
||||
.search(path.posix.join('.', configPath, fallbackNamespace))
|
||||
.then(it => it!.config);
|
||||
}
|
||||
return configLoader(moduleName)
|
||||
.search(path.posix.join('.', configPath, namespace))
|
||||
.then(it => it!.config as T)
|
||||
.catch(() =>
|
||||
configLoader(moduleName)
|
||||
.search(path.posix.join('.', configPath, fallbackNamespace))
|
||||
.then(it => it!.config),
|
||||
);
|
||||
}
|
||||
|
||||
const namespace = process.env.NODE_APP_INSTANCE;
|
||||
const database = process.env.NODE_CONFIG_ENV;
|
||||
/**
|
||||
* Loads a config file
|
||||
*/
|
||||
async function loadConfig<T>(moduleName: string): Promise<T> {
|
||||
const namespace = process.env.NODE_APP_INSTANCE;
|
||||
const database = process.env.NODE_CONFIG_ENV;
|
||||
|
||||
export const prometheusConfig = await findConfig<unknown>('prometheus', namespace);
|
||||
const config = await findConfig<T>(moduleName, namespace);
|
||||
if (database) {
|
||||
const databaseConfig = await findConfig<T>(database, namespace);
|
||||
return deepmerge(config, databaseConfig);
|
||||
}
|
||||
|
||||
const backendConfigWithoutDatabase = await findConfig<SCConfigFile>('backend', namespace);
|
||||
export const backendConfig = database
|
||||
? deepmerge(backendConfigWithoutDatabase, await findConfig<never>(database, namespace))
|
||||
: backendConfigWithoutDatabase;
|
||||
return config;
|
||||
}
|
||||
|
||||
export const backendConfig = await loadConfig<SCConfigFile>('backend');
|
||||
export const prometheusConfig = await loadConfig<unknown>('prometheus');
|
||||
|
||||
@@ -19,12 +19,12 @@ import {
|
||||
SCRoute,
|
||||
SCValidationErrorResponse,
|
||||
} from '@openstapps/core';
|
||||
import {ValidationError} from '@openstapps/core-tools/src/types/validator.js';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {Application, Router} from 'express';
|
||||
import PromiseRouter from 'express-promise-router';
|
||||
import {isTestEnvironment, validator} from '../common.js';
|
||||
import {isTestEnvironment} from '../common.js';
|
||||
import {isHttpMethod} from './http-types.js';
|
||||
import {validator} from '../validator.js';
|
||||
|
||||
/**
|
||||
* Creates a router from a route class and a handler function which implements the logic
|
||||
@@ -56,11 +56,8 @@ export function createRoute<REQUESTTYPE, RETURNTYPE>(
|
||||
// create a route handler for the given HTTP method
|
||||
route[verb](async (request, response) => {
|
||||
try {
|
||||
// validate request
|
||||
const requestValidation = validator.validate(request.body, routeClass.requestBodyName);
|
||||
|
||||
if (requestValidation.errors.length > 0) {
|
||||
const error = new SCValidationErrorResponse(requestValidation.errors, isTestEnvironment);
|
||||
if (!validator.validate(request.body, routeClass.requestBodyName as never)) {
|
||||
const error = new SCValidationErrorResponse(validator.errors as unknown[], isTestEnvironment);
|
||||
response.status(error.statusCode);
|
||||
response.json(error);
|
||||
await Logger.error(error);
|
||||
@@ -68,17 +65,13 @@ export function createRoute<REQUESTTYPE, RETURNTYPE>(
|
||||
return;
|
||||
}
|
||||
|
||||
// hand over request to handler with path parameters
|
||||
const handlerResponse = await handler(request.body, request.app, request.params);
|
||||
const handlerResponse = await handler(request.body as REQUESTTYPE, request.app, request.params);
|
||||
|
||||
// validate response generated by handler
|
||||
const responseErrors: ValidationError[] = validator.validate(
|
||||
handlerResponse,
|
||||
routeClass.responseBodyName,
|
||||
).errors;
|
||||
|
||||
if (responseErrors.length > 0) {
|
||||
const validationError = new SCValidationErrorResponse(responseErrors, isTestEnvironment);
|
||||
if (!validator.validate(handlerResponse, routeClass.responseBodyName)) {
|
||||
const validationError = new SCValidationErrorResponse(
|
||||
validator.errors as unknown[],
|
||||
isTestEnvironment,
|
||||
);
|
||||
// The validation error is not caused by faulty user input, but through an error that originates somewhere in
|
||||
// the backend, therefore we use this "stacked" error.
|
||||
const internalServerError = new SCInternalServerErrorResponse(validationError, isTestEnvironment);
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCInternalServerErrorResponse, SCPluginMetaData, SCValidationErrorResponse} from '@openstapps/core';
|
||||
import {Request} from 'express';
|
||||
import got from 'got';
|
||||
import {isTestEnvironment, validator} from '../common.js';
|
||||
import {isTestEnvironment} from '../common.js';
|
||||
import {backendConfig} from '../config.js';
|
||||
import {validator} from '../validator.js';
|
||||
|
||||
/**
|
||||
* Generic route function used to proxy actual requests to plugins
|
||||
@@ -28,10 +28,9 @@ import {backendConfig} from '../config.js';
|
||||
*/
|
||||
export async function virtualPluginRoute(request: Request, plugin: SCPluginMetaData): Promise<object> {
|
||||
try {
|
||||
const requestValidation = validator.validate(request.body, plugin.requestSchema);
|
||||
if (requestValidation.errors.length > 0) {
|
||||
if (!validator.validate(request.body, plugin.requestSchema)) {
|
||||
// noinspection ExceptionCaughtLocallyJS
|
||||
throw new SCValidationErrorResponse(requestValidation.errors, isTestEnvironment);
|
||||
throw new SCValidationErrorResponse(validator.errors as unknown[], isTestEnvironment);
|
||||
}
|
||||
// send the request to the plugin (forward the body) and save the response
|
||||
const response = await got.post(plugin.route.replaceAll(/^\//gi, ''), {
|
||||
@@ -43,10 +42,9 @@ export async function virtualPluginRoute(request: Request, plugin: SCPluginMetaD
|
||||
responseType: 'json',
|
||||
});
|
||||
const responseBody = response.body;
|
||||
const responseValidation = validator.validate(responseBody, plugin.responseSchema);
|
||||
if (responseValidation.errors.length > 0) {
|
||||
if (!validator.validate(responseBody, plugin.responseSchema)) {
|
||||
// noinspection ExceptionCaughtLocallyJS
|
||||
throw new SCValidationErrorResponse(responseValidation.errors, isTestEnvironment);
|
||||
throw new SCValidationErrorResponse(validator.errors as unknown[], isTestEnvironment);
|
||||
}
|
||||
return responseBody as object;
|
||||
} catch (error) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {parseAggregations} from './aggregations.js';
|
||||
import * as Monitoring from './monitoring.js';
|
||||
import {buildQuery} from './query/query.js';
|
||||
import {buildSort} from './query/sort.js';
|
||||
import {aggregations, putTemplate} from './templating.js';
|
||||
import {putTemplate} from './templating.js';
|
||||
import {
|
||||
ElasticsearchConfig,
|
||||
ElasticsearchQueryDisMaxConfig,
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
} from './util/index.js';
|
||||
import {noUndefined} from './util/no-undefined.js';
|
||||
import {retryCatch, RetryOptions} from './util/retry.js';
|
||||
import config from '@openstapps/core/elasticsearch.json' assert {type: 'json'};
|
||||
|
||||
/**
|
||||
* A database interface for elasticsearch
|
||||
@@ -84,10 +85,7 @@ export class Elasticsearch implements Database {
|
||||
* @param config an assembled config file
|
||||
* @param mailQueue a mail queue for monitoring
|
||||
*/
|
||||
constructor(
|
||||
private readonly config: SCConfigFile,
|
||||
mailQueue?: MailQueue,
|
||||
) {
|
||||
constructor(private readonly config: SCConfigFile, mailQueue?: MailQueue) {
|
||||
if (config.internal.database === undefined || typeof config.internal.database.version !== 'string') {
|
||||
throw new TypeError('Database version is undefined. Check your config file');
|
||||
}
|
||||
@@ -373,7 +371,7 @@ export class Elasticsearch implements Database {
|
||||
};
|
||||
|
||||
const response: SearchResponse<SCThings> = await this.client.search({
|
||||
aggs: aggregations,
|
||||
...config.search,
|
||||
query: buildQuery(parameters, this.config, esConfig),
|
||||
from: parameters.from,
|
||||
index: ACTIVE_INDICES_ALIAS,
|
||||
|
||||
@@ -15,19 +15,7 @@
|
||||
*/
|
||||
import {Client} from '@elastic/elasticsearch';
|
||||
import {SCThingType} from '@openstapps/core';
|
||||
import type {AggregationSchema} from '@openstapps/core/lib/mappings/aggregations.json.js';
|
||||
import type {ElasticsearchTemplateCollection} from '@openstapps/core/lib/mappings/mappings.json.js';
|
||||
import {readFileSync} from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const mappingsPath = path.resolve('node_modules', '@openstapps', 'core', 'lib', 'mappings');
|
||||
|
||||
export const mappings = JSON.parse(
|
||||
readFileSync(path.resolve(mappingsPath, 'mappings.json'), 'utf8'),
|
||||
) as ElasticsearchTemplateCollection;
|
||||
export const aggregations = JSON.parse(
|
||||
readFileSync(path.resolve(mappingsPath, 'aggregations.json'), 'utf8'),
|
||||
) as AggregationSchema;
|
||||
import config from '@openstapps/core/elasticsearch.json' assert {type: 'json'};
|
||||
|
||||
/**
|
||||
* Prepares all indices
|
||||
@@ -40,7 +28,7 @@ export async function putTemplate(client: Client, type: SCThingType) {
|
||||
const sanitizedType = `template_${type.replaceAll(/\s/g, '_')}`;
|
||||
|
||||
return client.indices.putTemplate({
|
||||
body: mappings[sanitizedType],
|
||||
body: config.mappings[sanitizedType],
|
||||
name: sanitizedType,
|
||||
});
|
||||
}
|
||||
|
||||
3
backend/backend/src/validator.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import {Validator} from '@openstapps/core-validator';
|
||||
|
||||
export const validator = new Validator();
|
||||
@@ -25,12 +25,12 @@ import bodyParser from 'body-parser';
|
||||
import sinon from 'sinon';
|
||||
import {expect} from 'chai';
|
||||
import {Application} from 'express';
|
||||
import {validator} from '../../src/common.js';
|
||||
import {createRoute} from '../../src/routes/route.js';
|
||||
import express, {Express} from 'express';
|
||||
import supertest from 'supertest';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {DEFAULT_TEST_TIMEOUT} from '../common.js';
|
||||
import {validator} from '../../src/validator.js';
|
||||
|
||||
interface ReturnType {
|
||||
foo: boolean;
|
||||
@@ -78,8 +78,7 @@ describe('Create route', async function () {
|
||||
|
||||
it('should complain (throw an error) if used method is other than defined in the route creation', async function () {
|
||||
const methodNotAllowedError = new SCMethodNotAllowedErrorResponse();
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
sandbox.stub(validator, 'validate').returns(true);
|
||||
let error: any = {};
|
||||
sandbox.stub(Logger, 'warn').callsFake(error_ => {
|
||||
error = error_;
|
||||
@@ -97,8 +96,7 @@ describe('Create route', async function () {
|
||||
});
|
||||
|
||||
it('should provide a route which returns handler response and success code', async function () {
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
sandbox.stub(validator, 'validate').returns(true);
|
||||
const router = createRoute<any, any>(routeClass, handler);
|
||||
app.use(router);
|
||||
|
||||
@@ -115,8 +113,7 @@ describe('Create route', async function () {
|
||||
app.use(router);
|
||||
const startApp = supertest(app);
|
||||
const validatorStub = sandbox.stub(validator, 'validate');
|
||||
// @ts-expect-error not assignable
|
||||
validatorStub.withArgs(body, routeClass.requestBodyName).returns({errors: [new Error('Foo Error')]});
|
||||
validatorStub.withArgs(body, routeClass.requestBodyName).returns(false);
|
||||
|
||||
const response = await startApp
|
||||
.post(routeClass.urlPath)
|
||||
@@ -131,12 +128,8 @@ describe('Create route', async function () {
|
||||
const router = createRoute<any, any>(routeClass, handler);
|
||||
await app.use(router);
|
||||
const startApp = supertest(app);
|
||||
// @ts-expect-error not assignable
|
||||
const validatorStub = sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
validatorStub
|
||||
.withArgs(bodySuccess, routeClass.responseBodyName)
|
||||
// @ts-expect-error not assignable
|
||||
.returns({errors: [new Error('Foo Error')]});
|
||||
const validatorStub = sandbox.stub(validator, 'validate').returns(false);
|
||||
validatorStub.withArgs(bodySuccess, routeClass.responseBodyName).returns(false);
|
||||
|
||||
const response = await startApp.post(routeClass.urlPath).send();
|
||||
|
||||
@@ -177,8 +170,7 @@ describe('Create route', async function () {
|
||||
await app.use(router);
|
||||
const startApp = supertest(app);
|
||||
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
sandbox.stub(validator, 'validate').returns(false);
|
||||
|
||||
const response = await startApp.post(routeClass.urlPath).send();
|
||||
|
||||
@@ -213,8 +205,7 @@ describe('Create route', async function () {
|
||||
await app.use(router);
|
||||
const startApp = supertest(app);
|
||||
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
sandbox.stub(validator, 'validate').returns(false);
|
||||
|
||||
const response = await startApp.post(routeClass.urlPath).send();
|
||||
|
||||
|
||||
@@ -22,11 +22,12 @@ import got, {Options} from 'got';
|
||||
import nock from 'nock';
|
||||
import sinon from 'sinon';
|
||||
import {mockReq} from 'sinon-express-mock';
|
||||
import {plugins, validator} from '../../src/common.js';
|
||||
import {plugins} from '../../src/common.js';
|
||||
import {virtualPluginRoute} from '../../src/routes/virtual-plugin-route.js';
|
||||
import {DEFAULT_TEST_TIMEOUT, FooError} from '../common.js';
|
||||
import {registerAddRequest} from './plugin-register-route.spec.js';
|
||||
import {testApp} from '../tests-setup.js';
|
||||
import {validator} from '../../src/validator.js';
|
||||
|
||||
use(chaiAsPromised);
|
||||
|
||||
@@ -71,8 +72,7 @@ describe('Virtual plugin routes', async function () {
|
||||
// spy the post method of got
|
||||
// @ts-expect-error not assignable
|
||||
const gotStub = sandbox.stub(got, 'post').returns({body: {}});
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(validator, 'validate').returns({errors: []});
|
||||
sandbox.stub(validator, 'validate').returns(true);
|
||||
const request_ = mockReq(request);
|
||||
|
||||
await virtualPluginRoute(request_, plugin);
|
||||
|
||||
@@ -34,7 +34,6 @@ import mockedEnv from 'mocked-env';
|
||||
import sinon, {SinonStub} from 'sinon';
|
||||
import {removeInvalidAliasChars} from '../../../src/storage/elasticsearch/util/alias.js';
|
||||
import {MailQueue} from '../../../src/notification/mail-queue.js';
|
||||
import {aggregations} from '../../../src/storage/elasticsearch/templating.js';
|
||||
import {Elasticsearch} from '../../../src/storage/elasticsearch/elasticsearch.js';
|
||||
import {bulk, DEFAULT_TEST_TIMEOUT, getTransport, getIndex} from '../../common.js';
|
||||
import fs from 'fs';
|
||||
@@ -50,6 +49,7 @@ import {
|
||||
} from '../../../src/storage/elasticsearch/util/index.js';
|
||||
import cron from 'node-cron';
|
||||
import {query} from './query.js';
|
||||
import {search} from '@openstapps/core/elasticsearch.json' assert {type: 'json'};
|
||||
|
||||
use(chaiAsPromised);
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('Elasticsearch', function () {
|
||||
expect(indexUID.length).to.be.equal(INDEX_UID_LENGTH);
|
||||
// test starting and ending character
|
||||
expect(indexUID[0]).to.be.equal(bulk.uid[0]);
|
||||
expect(indexUID[indexUID.length - 1]).to.be.equal(bulk.uid[INDEX_UID_LENGTH - 1]);
|
||||
expect(indexUID.at(-1)).to.be.equal(bulk.uid[INDEX_UID_LENGTH - 1]);
|
||||
});
|
||||
|
||||
it('should provide index name from the provided data', function () {
|
||||
@@ -679,7 +679,7 @@ describe('Elasticsearch', function () {
|
||||
await es.search(parameters);
|
||||
|
||||
expect(searchStub.firstCall.firstArg).to.be.deep.equal({
|
||||
aggs: aggregations,
|
||||
...search,
|
||||
query,
|
||||
allow_no_indices: true,
|
||||
sort: [{'name.sort': 'desc'}],
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"allowJs": true,
|
||||
"checkJs": true
|
||||
},
|
||||
"exclude": ["app.js", "lib/"]
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
|
||||
10
backend/backend/tsup.config.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/cli.ts'],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
target: 'esnext',
|
||||
format: 'esm',
|
||||
outDir: 'lib',
|
||||
});
|
||||
256
backend/copy-connector/CHANGELOG.md
Normal file
@@ -0,0 +1,256 @@
|
||||
# @openstapps/minimal-connector
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- 64caebaf: Move project to a turbo monorepo & pnpm
|
||||
|
||||
Internal dependencies are now defined using `"@openstapps/package": "workspace:*"`
|
||||
|
||||
- Removed extraneous files from packages
|
||||
- `.npmrc`
|
||||
- `.npmignore`
|
||||
- `.mailmap`
|
||||
- `.gitignore`
|
||||
- `CONTRIBUTING.md`
|
||||
- `LICENSE` (Project license file is added upon publishing, see [pnpm.io](https://pnpm.io/cli/publish))
|
||||
- `package-lock.json`
|
||||
- `.editorconfig`
|
||||
- `.eslintrc.json` (moved eslint config to `package.json`)
|
||||
- `.eslintignore`
|
||||
- `.gitlab-ci.yml` (Most workflows are workspace-level)
|
||||
- `.gitlab/**` (issue templates etc. are now workspace-level)
|
||||
- `.dockerignore` (Docker files are determined by which files are deployed with `pnpm deploy`, as per `package.json/files`)
|
||||
- TSConfig has been moved to its own package (You can now use `"extends": "@openstapps/tsconfig"`)
|
||||
- Removed ESLint and Prettier peer dependency hell by injecting them through the `.pnpmfile.cjs`
|
||||
- Added syncpack for keeping dependency versions in sync (and consistent key ordering in `package.json`)
|
||||
- Replaced conventional changelog with changesets
|
||||
- Apps with binaries now use a top level `app.js`
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
import './lib/app.js';
|
||||
```
|
||||
|
||||
- 64caebaf: Migrate to ESM
|
||||
|
||||
CommonJS is no longer supported in any capacity. To use the new
|
||||
version, you will need to migrate your package to ESM.
|
||||
We recommend using `tsup` and `Node 18`.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
```
|
||||
|
||||
- 64caebaf: Migrate package to Node 18
|
||||
|
||||
- Consumers of this package will need to migrate to Node 18 or
|
||||
higher.
|
||||
- Packages have been migrated from promisified `readFile` or
|
||||
`readFileSync` towards `fs/promises`
|
||||
- Packages use native `flatMap` now
|
||||
|
||||
- 64caebaf: Migrate build system to `tsup`
|
||||
|
||||
All packages now use an `index.ts` file to expose contents.
|
||||
|
||||
You will need to migrate paths from `import foo from '@scope/package/lib/foo` to `import foo from '@scope/package'`
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 64caebaf: Migrate tests to C8/Chai/Mocha
|
||||
|
||||
- `@testdeck` OOP testing has been removed.
|
||||
- Tests have been unified
|
||||
- CommonJS module mocking has been replaced through
|
||||
refactoring of tests, as ES Modules cannot be mocked
|
||||
(do yourself a favor and don't try to mock them)
|
||||
- C8 now replaces NYC as a native coverage tool
|
||||
|
||||
- 64caebaf: Migrate away from `@krlwlfrt/async-pool`
|
||||
|
||||
```ts
|
||||
import {mapAsyncLimit} from '@openstapps/collection-utils';
|
||||
|
||||
await mapAsyncLimit(
|
||||
[1, 2, 3],
|
||||
async it => {
|
||||
await someNetworkRequest(it);
|
||||
},
|
||||
5,
|
||||
);
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 64caebaf: Migrated changelogs to changeset format
|
||||
|
||||
```js
|
||||
import fs from 'fs';
|
||||
|
||||
const path = 'packages/logger/CHANGELOG.md';
|
||||
|
||||
fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## ['));
|
||||
```
|
||||
|
||||
- 98546a97: Migrate away from @openstapps/configuration
|
||||
- 23481d0d: Update to TypeScript 5.1.6
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [1f62b5c5]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [23481d0d]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [0a7e6af1]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [64caebaf]
|
||||
- @openstapps/api@3.0.0
|
||||
- @openstapps/logger@3.0.0
|
||||
- @openstapps/core@3.0.0
|
||||
|
||||
## 3.0.0-next.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 23481d0d: Update to TypeScript 5.1.6
|
||||
- Updated dependencies [23481d0d]
|
||||
- @openstapps/logger@3.0.0-next.4
|
||||
- @openstapps/core@3.0.0-next.4
|
||||
- @openstapps/api@3.0.0-next.4
|
||||
|
||||
## 3.0.0-next.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- 64caebaf: Move project to a turbo monorepo & pnpm
|
||||
|
||||
Internal dependencies are now defined using `"@openstapps/package": "workspace:*"`
|
||||
|
||||
- Removed extraneous files from packages
|
||||
- `.npmrc`
|
||||
- `.npmignore`
|
||||
- `.mailmap`
|
||||
- `.gitignore`
|
||||
- `CONTRIBUTING.md`
|
||||
- `LICENSE` (Project license file is added upon publishing, see [pnpm.io](https://pnpm.io/cli/publish))
|
||||
- `package-lock.json`
|
||||
- `.editorconfig`
|
||||
- `.eslintrc.json` (moved eslint config to `package.json`)
|
||||
- `.eslintignore`
|
||||
- `.gitlab-ci.yml` (Most workflows are workspace-level)
|
||||
- `.gitlab/**` (issue templates etc. are now workspace-level)
|
||||
- `.dockerignore` (Docker files are determined by which files are deployed with `pnpm deploy`, as per `package.json/files`)
|
||||
- TSConfig has been moved to its own package (You can now use `"extends": "@openstapps/tsconfig"`)
|
||||
- Removed ESLint and Prettier peer dependency hell by injecting them through the `.pnpmfile.cjs`
|
||||
- Added syncpack for keeping dependency versions in sync (and consistent key ordering in `package.json`)
|
||||
- Replaced conventional changelog with changesets
|
||||
- Apps with binaries now use a top level `app.js`
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
import './lib/app.js';
|
||||
```
|
||||
|
||||
- 64caebaf: Migrate to ESM
|
||||
|
||||
CommonJS is no longer supported in any capacity. To use the new
|
||||
version, you will need to migrate your package to ESM.
|
||||
We recommend using `tsup` and `Node 18`.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
```
|
||||
|
||||
- 64caebaf: Migrate package to Node 18
|
||||
|
||||
- Consumers of this package will need to migrate to Node 18 or
|
||||
higher.
|
||||
- Packages have been migrated from promisified `readFile` or
|
||||
`readFileSync` towards `fs/promises`
|
||||
- Packages use native `flatMap` now
|
||||
|
||||
- 64caebaf: Migrate build system to `tsup`
|
||||
|
||||
All packages now use an `index.ts` file to expose contents.
|
||||
|
||||
You will need to migrate paths from `import foo from '@scope/package/lib/foo` to `import foo from '@scope/package'`
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 64caebaf: Migrate tests to C8/Chai/Mocha
|
||||
|
||||
- `@testdeck` OOP testing has been removed.
|
||||
- Tests have been unified
|
||||
- CommonJS module mocking has been replaced through
|
||||
refactoring of tests, as ES Modules cannot be mocked
|
||||
(do yourself a favor and don't try to mock them)
|
||||
- C8 now replaces NYC as a native coverage tool
|
||||
|
||||
- 64caebaf: Migrate away from `@krlwlfrt/async-pool`
|
||||
|
||||
```ts
|
||||
import {mapAsyncLimit} from '@openstapps/collection-utils';
|
||||
|
||||
await mapAsyncLimit(
|
||||
[1, 2, 3],
|
||||
async it => {
|
||||
await someNetworkRequest(it);
|
||||
},
|
||||
5,
|
||||
);
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 64caebaf: Migrated changelogs to changeset format
|
||||
|
||||
```js
|
||||
import fs from 'fs';
|
||||
|
||||
const path = 'packages/logger/CHANGELOG.md';
|
||||
|
||||
fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## ['));
|
||||
```
|
||||
|
||||
- 98546a97: Migrate away from @openstapps/configuration
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [0a7e6af1]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [64caebaf]
|
||||
- Updated dependencies [98546a97]
|
||||
- Updated dependencies [64caebaf]
|
||||
- @openstapps/api@3.0.0-next.0
|
||||
- @openstapps/logger@3.0.0-next.0
|
||||
- @openstapps/core@3.0.0-next.0
|
||||
|
||||
## [0.2.0](https://gitlab.com/openstapps/minimal-connector/compare/v0.1.0...v0.2.0) (2019-02-07)
|
||||
|
||||
## [0.1.0](https://gitlab.com/openstapps/minimal-connector/compare/v0.0.2...v0.1.0) (2019-01-30)
|
||||
|
||||
## [0.0.2](https://gitlab.com/openstapps/minimal-connector/compare/v0.0.1...v0.0.2) (2018-12-03)
|
||||
|
||||
## [0.0.1](https://gitlab.com/openstapps/minimal-connector/compare/d332f6e...v0.0.1) (2018-12-03)
|
||||
|
||||
### Features
|
||||
|
||||
- add minimal connector ([d332f6e](https://gitlab.com/openstapps/minimal-connector/commit/d332f6e))
|
||||
5
backend/copy-connector/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM registry.gitlab.com/openstapps/openstapps/node-base
|
||||
|
||||
ADD . .
|
||||
|
||||
ENTRYPOINT ["node", "lib/cli.js"]
|
||||
3
backend/copy-connector/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# @openstapps/copy-connector
|
||||
|
||||
A default connector that copies data from one backend to another
|
||||
2
backend/copy-connector/app.js
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import './lib/cli.js';
|
||||
77
backend/copy-connector/package.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "@openstapps/copy-connector",
|
||||
"description": "This is a minimal connector which serves as an example",
|
||||
"version": "3.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"repository": "git@gitlab.com:openstapps/minimal-connector.git",
|
||||
"author": "Anselm Stordeur <anselmstordeur@gmail.com>",
|
||||
"contributors": [
|
||||
"Jovan Krunić <jovan.krunic@gmail.com>",
|
||||
"Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
|
||||
"Michel Jonathan Schmitz <michel.schmitz1992@gmail.com>",
|
||||
"Rainer Killinger <git@killinger.co>"
|
||||
],
|
||||
"bin": "app.js",
|
||||
"files": [
|
||||
"app.js",
|
||||
"lib",
|
||||
"Dockerfile",
|
||||
"README.md",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup-node",
|
||||
"deploy": "pnpm --prod --filter=@openstapps/copy-connector deploy ../../.deploy/copy-connector",
|
||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||
"lint": "tsc --noEmit && eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"test": "c8 --exclude src/cli.ts mocha --exit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openstapps/api": "workspace:*",
|
||||
"@openstapps/core": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"@types/cli-progress": "3.11.5",
|
||||
"cli-progress": "3.12.0",
|
||||
"commander": "10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@types/chai": "4.3.5",
|
||||
"@types/chai-as-promised": "7.1.5",
|
||||
"@types/chai-spies": "1.0.6",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.3",
|
||||
"c8": "7.14.0",
|
||||
"chai": "4.3.7",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"chai-spies": "1.1.0",
|
||||
"conventional-changelog-cli": "2.2.2",
|
||||
"mocha": "10.2.0",
|
||||
"mocha-junit-reporter": "2.2.0",
|
||||
"nock": "13.3.1",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/cli.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@openstapps"
|
||||
]
|
||||
}
|
||||
}
|
||||
50
backend/copy-connector/src/cli.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2018, 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.
|
||||
*
|
||||
* 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 {Logger} from '@openstapps/logger';
|
||||
import {Command} from 'commander';
|
||||
import {version} from '../package.json';
|
||||
import {copy} from './copy.js';
|
||||
import {SCThingType, STAPPS_CORE_VERSION} from '@openstapps/core';
|
||||
import {Client, ConnectorClient, HttpClient} from '@openstapps/api';
|
||||
|
||||
new Command()
|
||||
.command('run <backendURL> <origin> <licensePlate>')
|
||||
.argument('<backendUrl>', 'The URL of the StApps deployment', 'http://localhost:3000')
|
||||
.argument(
|
||||
'<foreignBackendUrl>',
|
||||
'The URL of the backend to copy the data from',
|
||||
'https://mobile.server.uni-frankfurt.de',
|
||||
)
|
||||
.argument('<types>', 'The type (RegExp full match)', '.*')
|
||||
.argument('<batchSize>', 'Batch Size', 100)
|
||||
.version(version)
|
||||
.action(async (backendUrl: string, foreignBackendUrl: string, types: string, batchSize: number) => {
|
||||
const client = new HttpClient();
|
||||
const apiIn = new Client(client, foreignBackendUrl, STAPPS_CORE_VERSION);
|
||||
const apiOut = new ConnectorClient(client, backendUrl);
|
||||
|
||||
const indexResponse = await apiIn.handshake(STAPPS_CORE_VERSION);
|
||||
const origin = new URL(foreignBackendUrl).host.replaceAll(/[^a-zA-Z0-9-]/g, '-');
|
||||
const licensePlate = indexResponse.backend.namespace;
|
||||
const source = `${licensePlate}-${origin}`;
|
||||
|
||||
for (const type of Object.values(SCThingType)) {
|
||||
if (!new RegExp(`^${types}$`).test(type)) continue;
|
||||
await copy(apiIn, apiOut, source, type, batchSize);
|
||||
}
|
||||
Logger.ok('Done');
|
||||
})
|
||||
.addHelpCommand()
|
||||
.parse(process.argv);
|
||||
@@ -14,60 +14,30 @@
|
||||
*/
|
||||
import {SCSearchRequest, SCThingType} from '@openstapps/core';
|
||||
import {Bar} from 'cli-progress';
|
||||
import {Client, ConnectorClient, OutOfRangeError, HttpClientInterface} from '@openstapps/api';
|
||||
|
||||
/**
|
||||
* Options to set up copying data from one backend to another
|
||||
*/
|
||||
export interface CopyOptions {
|
||||
/**
|
||||
* Batch size to copy at once
|
||||
*/
|
||||
batchSize: number;
|
||||
|
||||
/**
|
||||
* URL of the backend to copy from
|
||||
*/
|
||||
from: string;
|
||||
|
||||
/**
|
||||
* Source identifier
|
||||
*/
|
||||
source: string;
|
||||
|
||||
/**
|
||||
* URL of the backend to copy to
|
||||
*/
|
||||
to: string;
|
||||
|
||||
/**
|
||||
* StAppsCore type to copy
|
||||
*/
|
||||
type: SCThingType;
|
||||
|
||||
/**
|
||||
* StApps version identifier to copy data for
|
||||
*/
|
||||
version: string;
|
||||
}
|
||||
import {Client, ConnectorClient, OutOfRangeError} from '@openstapps/api';
|
||||
|
||||
/**
|
||||
* Copy data for a StAppsCore type from one backend to another
|
||||
* @param client HTTP client
|
||||
* @param options Map of options
|
||||
* @param apiIn The API for the backend to copy from
|
||||
* @param apiOut The API for the backend to copy to
|
||||
* @param source The source identifier for the bulk
|
||||
* @param type The SCThingType to copy
|
||||
* @param batchSize The batch size for the copy operation
|
||||
*/
|
||||
export async function copy(client: HttpClientInterface, options: CopyOptions): Promise<void> {
|
||||
const apiIn = new Client(client, options.from, options.version);
|
||||
const apiOut = new ConnectorClient(client, options.to);
|
||||
|
||||
// open a bulk
|
||||
const bulk = await apiOut.bulk(options.type, options.source);
|
||||
export async function copy(
|
||||
apiIn: Client,
|
||||
apiOut: ConnectorClient,
|
||||
source: string,
|
||||
type: SCThingType,
|
||||
batchSize: number,
|
||||
): Promise<void> {
|
||||
const bulk = await apiOut.bulk(type, source);
|
||||
|
||||
let searchRequest: SCSearchRequest = {
|
||||
filter: {
|
||||
arguments: {
|
||||
field: 'type',
|
||||
value: options.type,
|
||||
value: type,
|
||||
},
|
||||
type: 'value',
|
||||
},
|
||||
@@ -76,7 +46,7 @@ export async function copy(client: HttpClientInterface, options: CopyOptions): P
|
||||
|
||||
let searchResponse = await apiIn.search(searchRequest);
|
||||
|
||||
searchRequest.size = options.batchSize;
|
||||
searchRequest.size = batchSize;
|
||||
|
||||
const progressBar = new Bar({});
|
||||
progressBar.start(searchResponse.pagination.total, 0);
|
||||
@@ -27,20 +27,26 @@ import {
|
||||
import chai from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import chaiSpies from 'chai-spies';
|
||||
import {ApiError, HttpClient, HttpClientRequest, HttpClientResponse} from '@openstapps/api';
|
||||
import {
|
||||
ApiError,
|
||||
HttpClient,
|
||||
HttpClientRequest,
|
||||
HttpClientResponse,
|
||||
Client,
|
||||
ConnectorClient,
|
||||
} from '@openstapps/api';
|
||||
import {copy} from '../src/copy.js';
|
||||
|
||||
/**
|
||||
* Recursive Partial
|
||||
*
|
||||
* @see https://stackoverflow.com/a/51365037
|
||||
*/
|
||||
export type RecursivePartial<T> = {
|
||||
[P in keyof T]?: T[P] extends Array<infer U>
|
||||
? Array<RecursivePartial<U>>
|
||||
: T[P] extends object
|
||||
? RecursivePartial<T[P]>
|
||||
: T[P];
|
||||
? RecursivePartial<T[P]>
|
||||
: T[P];
|
||||
};
|
||||
|
||||
chai.should();
|
||||
@@ -134,14 +140,13 @@ describe('Copy', function () {
|
||||
},
|
||||
);
|
||||
|
||||
await copy(httpClient, {
|
||||
batchSize: 5,
|
||||
from: 'http://foo.bar',
|
||||
source: 'stapps-copy',
|
||||
to: 'http://localhost',
|
||||
type: SCThingType.Dish,
|
||||
version: 'foo.bar.foobar',
|
||||
});
|
||||
await copy(
|
||||
new Client(httpClient, 'http://foo.bar'),
|
||||
new ConnectorClient(httpClient, 'http://localhost'),
|
||||
'stapps-copy',
|
||||
SCThingType.Dish,
|
||||
5,
|
||||
);
|
||||
});
|
||||
|
||||
it('should fail to copy', async function () {
|
||||
@@ -216,13 +221,12 @@ describe('Copy', function () {
|
||||
},
|
||||
);
|
||||
|
||||
await copy(httpClient, {
|
||||
batchSize: 5,
|
||||
from: 'http://foo.bar',
|
||||
source: 'stapps-copy',
|
||||
to: 'http://localhost',
|
||||
type: SCThingType.Dish,
|
||||
version: 'foo.bar.foobar',
|
||||
}).should.be.rejectedWith(ApiError);
|
||||
await copy(
|
||||
new Client(httpClient, 'http://foo.bar'),
|
||||
new ConnectorClient(httpClient, 'http://localhost'),
|
||||
'stapps-copy',
|
||||
SCThingType.Dish,
|
||||
5,
|
||||
).should.be.rejectedWith(ApiError);
|
||||
});
|
||||
});
|
||||
@@ -6,5 +6,8 @@
|
||||
"config",
|
||||
"Dockerfile",
|
||||
"README.md"
|
||||
]
|
||||
],
|
||||
"scripts": {
|
||||
"start": "docker run --rm -t -p 9200:9200 -p 9300:9300 $(docker build -q .)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,5 @@
|
||||
# @openstapps/api-cli
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix version history offered by backend
|
||||
- Updated dependencies
|
||||
- @openstapps/api@3.1.1
|
||||
- @openstapps/core@3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- f6187255: Add "\*" option to copy command that allows for a full database clone
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8ca10]
|
||||
- @openstapps/core@3.1.0
|
||||
- @openstapps/api@3.1.0
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
2
backend/e2e-connector/app.js
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import './lib/cli.js';
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openstapps/api-cli",
|
||||
"description": "CLI client for @openstapps/api",
|
||||
"version": "3.1.1",
|
||||
"name": "@openstapps/e2e-connector",
|
||||
"description": "Connector for running e2e tests",
|
||||
"version": "3.0.0",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"repository": "git@gitlab.com:openstapps/api.git",
|
||||
@@ -15,9 +15,7 @@
|
||||
"Roman Klopsch",
|
||||
"Thea Schöbl <dev@theaninova.de>"
|
||||
],
|
||||
"bin": {
|
||||
"openstapps-api": "app.js"
|
||||
},
|
||||
"bin": "app.js",
|
||||
"files": [
|
||||
"app.js",
|
||||
"lib",
|
||||
@@ -27,23 +25,21 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup-node",
|
||||
"deploy": "pnpm --prod --filter=@openstapps/api-cli deploy ../../.deploy/api-cli",
|
||||
"deploy": "pnpm --prod --filter=@openstapps/e2e-connector deploy ../../.deploy/e2e-connector",
|
||||
"format": "prettier . -c --ignore-path ../../.gitignore",
|
||||
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
|
||||
"lint": "tsc --noEmit && eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"test": "c8 mocha --exit"
|
||||
"test": "c8 --exclude src/cli.ts mocha --exit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openstapps/api": "workspace:*",
|
||||
"@openstapps/core": "workspace:*",
|
||||
"@openstapps/core-tools": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"@types/cli-progress": "3.11.0",
|
||||
"@types/cli-progress": "3.11.5",
|
||||
"@types/express": "4.17.17",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/json-schema": "7.0.11",
|
||||
"@types/json-schema": "7.0.14",
|
||||
"@types/junit-report-builder": "3.0.0",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.3",
|
||||
@@ -55,26 +51,26 @@
|
||||
"wait-on": "6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@types/chai": "4.3.5",
|
||||
"@types/chai-as-promised": "7.1.5",
|
||||
"@types/chai-spies": "1.0.3",
|
||||
"@types/chai-spies": "1.0.6",
|
||||
"c8": "7.14.0",
|
||||
"chai": "4.3.7",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"chai-spies": "1.0.0",
|
||||
"chai-spies": "1.1.0",
|
||||
"mocha": "10.2.0",
|
||||
"mocha-junit-reporter": "2.2.0",
|
||||
"nock": "13.3.1",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "5.1.6"
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/app.ts",
|
||||
"src/index.ts"
|
||||
"src/cli.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
59
backend/e2e-connector/src/cli.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Open 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 {Logger} from '@openstapps/logger';
|
||||
import {Command} from 'commander';
|
||||
import {URL} from 'url';
|
||||
import waitOn from 'wait-on';
|
||||
import {HttpClient} from '@openstapps/api';
|
||||
import {version} from '../package.json';
|
||||
import {endToEndRun} from './end-to-end.js';
|
||||
|
||||
new Command()
|
||||
.command('<to>')
|
||||
.argument('<to>', 'The backend to test', url => new URL(url).toString(), 'http://localhost:3000')
|
||||
.version(version)
|
||||
.description(
|
||||
'Run in end to end test mode. Indexing and afterwards retrieving all test files from @openstapp/core to the backend',
|
||||
)
|
||||
.option(
|
||||
'-s --samples path',
|
||||
'Path to @openstapp/core test files',
|
||||
'./node_modules/@openstapps/core/test/resources/indexable',
|
||||
)
|
||||
.option('-w --waiton [resource]', 'wait-on resource parameter see "www.npmjs.com/wait-on"')
|
||||
.option('-r --reportPath [reportPath]', 'JUnit Report Path')
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
.action(async (to: string, e2eCommand: {samples: string; waiton?: string; reportPath?: string}) => {
|
||||
try {
|
||||
if (typeof e2eCommand.waiton === 'string') {
|
||||
Logger.info(`Waiting for availibilty of resource: ${e2eCommand.waiton}`);
|
||||
await waitOn({
|
||||
resources: [e2eCommand.waiton],
|
||||
timeout: 300_000,
|
||||
});
|
||||
Logger.info(`Resource became available`);
|
||||
}
|
||||
await endToEndRun(new HttpClient(), {
|
||||
to,
|
||||
samplesLocation: e2eCommand.samples,
|
||||
reportLocation: e2eCommand.reportPath,
|
||||
});
|
||||
Logger.ok('Done');
|
||||
} catch (error) {
|
||||
await Logger.error(error);
|
||||
}
|
||||
})
|
||||
.addHelpCommand()
|
||||
.parse(process.argv);
|
||||
20
backend/e2e-connector/src/compare-items.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import junit from 'junit-report-builder';
|
||||
import {deepStrictEqual} from 'assert';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {TestState} from './test-state.js';
|
||||
|
||||
/**
|
||||
* Compares all samples (local and remote) with the same uid and throws if they're not deep equal
|
||||
*/
|
||||
export async function compareItems(state: TestState, suite: junit.TestSuite) {
|
||||
for (const localThing of state.localItems.values()) {
|
||||
await state.runTest(suite, `Should be the same for ${localThing.type} (${localThing.uid})`, async () => {
|
||||
if (!state.remoteItems.has(localThing.uid)) {
|
||||
throw new Error(`Did not retrieve expected SCThing with uid: ${localThing.uid}`);
|
||||
}
|
||||
const remoteThing = state.remoteItems.get(localThing.uid);
|
||||
deepStrictEqual(remoteThing, localThing, `Unexpected difference between original and retrieved sample`);
|
||||
});
|
||||
}
|
||||
Logger.info(`All samples retrieved from the backend have been compared`);
|
||||
}
|
||||
48
backend/e2e-connector/src/end-to-end.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Open 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 {Logger} from '@openstapps/logger';
|
||||
import {HttpClientInterface} from '@openstapps/api';
|
||||
import junit from 'junit-report-builder';
|
||||
import {indexSamples} from './index-samples.js';
|
||||
import {retrieveItems} from './retreive-items.js';
|
||||
import {compareItems} from './compare-items.js';
|
||||
import {E2EOptions, TestState} from './test-state.js';
|
||||
|
||||
/**
|
||||
* Function that can be used for integration tests.
|
||||
* Adds all the SCThings that getItemsFromSamples() returns to the backend.
|
||||
* Afterward, retrieves the items from backend and checks for differences with original ones.
|
||||
*/
|
||||
export async function endToEndRun(client: HttpClientInterface, options: E2EOptions): Promise<string[]> {
|
||||
const state = new TestState(client, options);
|
||||
const builder = junit.newBuilder();
|
||||
|
||||
await indexSamples(state, builder.testSuite().name('e2e index'));
|
||||
Logger.info(`All samples have been indexed via the backend`);
|
||||
|
||||
await retrieveItems(state, builder.testSuite().name('e2e retrieve'));
|
||||
Logger.info(`All samples have been retrieved from the backend`);
|
||||
|
||||
await compareItems(state, builder.testSuite().name('e2e compare'));
|
||||
|
||||
if (options.reportLocation) {
|
||||
builder.writeTo(options.reportLocation);
|
||||
}
|
||||
await (state.errors.length > 0
|
||||
? Logger.error(`\n${state.errors.length} failed test cases`)
|
||||
: Logger.ok('All tests passed.'));
|
||||
|
||||
return state.errors;
|
||||
}
|
||||
29
backend/e2e-connector/src/get-items-from-samples.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import {SCThings} from '@openstapps/core';
|
||||
import {readdir, readFile} from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* Get all SCThings from the predefined core test json files
|
||||
* @param samplesDirectory Filepath to the directory containing to the core test json files
|
||||
* @returns an Array of all the SCThings specified for test usage
|
||||
*/
|
||||
export async function getItemsFromSamples<T extends SCThings>(samplesDirectory: string): Promise<T[]> {
|
||||
const things: T[] = [];
|
||||
try {
|
||||
const fileNames = await readdir(samplesDirectory);
|
||||
for (const fileName of fileNames) {
|
||||
const filePath = path.join(samplesDirectory, fileName);
|
||||
if (filePath.endsWith('.json')) {
|
||||
const fileContent = await readFile(filePath, {encoding: 'utf8'});
|
||||
const schemaObject = JSON.parse(fileContent);
|
||||
if (schemaObject.errorNames.length === 0 && typeof schemaObject.instance.type === 'string') {
|
||||
things.push(schemaObject.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return things;
|
||||
}
|
||||
33
backend/e2e-connector/src/index-samples.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import junit from 'junit-report-builder';
|
||||
import {SCThings, SCThingType} from '@openstapps/core';
|
||||
import {getItemsFromSamples} from './get-items-from-samples.js';
|
||||
import {TestState} from './test-state.js';
|
||||
|
||||
/**
|
||||
* Function to add all the SCThings that getItemsFromSamples() returns to the backend
|
||||
*/
|
||||
export async function indexSamples(state: TestState, suite: junit.TestSuite): Promise<void> {
|
||||
const items = await getItemsFromSamples(state.options.samplesLocation);
|
||||
|
||||
if (items.length === 0) {
|
||||
throw new Error('Could not index samples. None were retrieved from the file system.');
|
||||
}
|
||||
|
||||
// sort items by type
|
||||
const itemMap: Map<SCThingType, SCThings[]> = new Map();
|
||||
for (const item of items) {
|
||||
if (!itemMap.has(item.type)) {
|
||||
itemMap.set(item.type, []);
|
||||
}
|
||||
const itemsOfSameType = itemMap.get(item.type) as SCThings[];
|
||||
itemsOfSameType.push(item);
|
||||
itemMap.set(item.type, itemsOfSameType);
|
||||
state.localItems.set(item.uid, item);
|
||||
}
|
||||
// add items depending on their type property with one type per bulk
|
||||
for (const type of itemMap.keys()) {
|
||||
await state.runTest(suite, `Should index ${type}`, async () =>
|
||||
state.api.index(itemMap.get(type) as SCThings[], 'stapps-core-sample-data'),
|
||||
);
|
||||
}
|
||||
}
|
||||
30
backend/e2e-connector/src/retreive-items.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import junit from 'junit-report-builder';
|
||||
import {SCSearchRequest} from '@openstapps/core';
|
||||
import {TestState} from './test-state.js';
|
||||
|
||||
/**
|
||||
* Retrieves all samples previously index using the api
|
||||
*/
|
||||
export async function retrieveItems(state: TestState, suite: junit.TestSuite): Promise<void> {
|
||||
const singleItemSearchRequest: SCSearchRequest = {
|
||||
filter: {
|
||||
arguments: {
|
||||
field: 'uid',
|
||||
value: 'replace-me',
|
||||
},
|
||||
type: 'value',
|
||||
},
|
||||
};
|
||||
for (const {uid, type} of state.localItems.values()) {
|
||||
await state.runTest(suite, `Should find ${type} (${uid})`, async () => {
|
||||
singleItemSearchRequest.filter!.arguments.value = uid;
|
||||
const searchResponse = await state.api.search(singleItemSearchRequest);
|
||||
if (searchResponse.data.length !== 1) {
|
||||
throw new Error(
|
||||
`Search for single SCThing with uid: ${uid} returned ${searchResponse.data.length} results`,
|
||||
);
|
||||
}
|
||||
state.remoteItems.set(uid, searchResponse.data[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
66
backend/e2e-connector/src/test-state.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import {SCThings} from '@openstapps/core';
|
||||
import {ConnectorClient, HttpClientInterface} from '@openstapps/api';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import junit from 'junit-report-builder';
|
||||
|
||||
export class TestState {
|
||||
localItems = new Map<string, SCThings>();
|
||||
|
||||
remoteItems = new Map<string, SCThings>();
|
||||
|
||||
errors: string[] = [];
|
||||
|
||||
api: ConnectorClient;
|
||||
|
||||
constructor(client: HttpClientInterface, readonly options: E2EOptions) {
|
||||
this.api = new ConnectorClient(client, options.to);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a test
|
||||
* @param suite The suite the test belongs to
|
||||
* @param name The name of the test
|
||||
* @param scope The scope in which the test is run
|
||||
*/
|
||||
async runTest(suite: junit.TestSuite, name: string, scope: () => Promise<void>) {
|
||||
const testCase = suite.testCase().name(name);
|
||||
process.stdout.addListener('data', testCase.standardOutput);
|
||||
process.stderr.addListener('data', testCase.standardError);
|
||||
|
||||
const start = performance.now();
|
||||
try {
|
||||
await scope();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
await Logger.error(error);
|
||||
testCase.failure(error.message);
|
||||
this.errors.push(error.message);
|
||||
}
|
||||
|
||||
process.stdout.removeListener('data', testCase.standardOutput);
|
||||
process.stderr.removeListener('data', testCase.standardError);
|
||||
|
||||
const end = performance.now();
|
||||
testCase.time((end - start) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to set up indexing core test files to backend
|
||||
*/
|
||||
export interface E2EOptions {
|
||||
/**
|
||||
* File path of the directory containing core test files
|
||||
*/
|
||||
samplesLocation: string;
|
||||
|
||||
/**
|
||||
* URL of the backend to index to
|
||||
*/
|
||||
to: string;
|
||||
|
||||
/**
|
||||
* Location of the report
|
||||
*/
|
||||
reportLocation?: string;
|
||||
}
|
||||
@@ -30,12 +30,12 @@ import chaiSpies from 'chai-spies';
|
||||
import {existsSync, mkdirSync, rmdirSync, unlinkSync} from 'fs';
|
||||
import {createFileSync} from 'fs-extra';
|
||||
import {HttpClient, HttpClientRequest, HttpClientResponse} from '@openstapps/api';
|
||||
import {RecursivePartial} from './copy.spec.js';
|
||||
import {expect} from 'chai';
|
||||
import path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
import {e2eRun, getItemsFromSamples} from '../src/e2e.js';
|
||||
import {endToEndRun} from '../src/end-to-end.js';
|
||||
import {getItemsFromSamples} from '../src/get-items-from-samples.js';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
|
||||
chai.should();
|
||||
chai.use(chaiSpies);
|
||||
@@ -54,6 +54,13 @@ const httpClient = new HttpClient();
|
||||
const storedThings: Map<string, SCThings> = new Map();
|
||||
|
||||
describe('e2e Connector', function () {
|
||||
beforeEach(function () {
|
||||
sandbox.on(Logger, 'error', (...parameters) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('e2e:', ...parameters);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
});
|
||||
@@ -75,84 +82,74 @@ describe('e2e Connector', function () {
|
||||
let failOnCompare = false;
|
||||
let failOnLookup = false;
|
||||
|
||||
sandbox.on(
|
||||
httpClient,
|
||||
'request',
|
||||
async (request: HttpClientRequest): Promise<RecursivePartial<responses>> => {
|
||||
if (request.url.toString() === `http://localhost${bulkRoute.getUrlPath().toString()}`) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
sandbox.on(httpClient, 'request', async (request: HttpClientRequest): Promise<Partial<responses>> => {
|
||||
if (request.url.toString() === `http://localhost${bulkRoute.getUrlPath().toString()}`) {
|
||||
return {
|
||||
body: {
|
||||
state: 'in progress',
|
||||
uid: 'foo',
|
||||
},
|
||||
statusCode: bulkRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
request.url.toString() === `http://localhost${bulkAddRoute.getUrlPath({UID: 'foo'}).toString()}`
|
||||
) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
storedThings.set((request.body as any).uid, JSON.parse(JSON.stringify(request.body)));
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
request.url.toString() === `http://localhost${bulkDoneRoute.getUrlPath({UID: 'foo'}).toString()}`
|
||||
) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${searchRoute.getUrlPath().toString()}`) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const thing = storedThings.get((request.body as any).filter.arguments.value);
|
||||
if (failOnCompare) {
|
||||
thing!.origin!.modified = 'altered';
|
||||
}
|
||||
const returnThing = failOnLookup ? [] : [thing];
|
||||
const returnBody = {
|
||||
data: returnThing,
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: returnThing.length,
|
||||
offset: 0,
|
||||
total: returnThing.length,
|
||||
},
|
||||
stats: {
|
||||
time: 42,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
body: returnBody,
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
if (request.url.toString() === `http://localhost${bulkAddRoute.getUrlPath({UID: 'foo'}).toString()}`) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
storedThings.set((request.body as any).uid, JSON.parse(JSON.stringify(request.body)));
|
||||
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkAddRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${bulkDoneRoute.getUrlPath({UID: 'foo'}).toString()}`) {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: bulkDoneRoute.statusCodeSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
if (request.url.toString() === `http://localhost${searchRoute.getUrlPath().toString()}`) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const thing = storedThings.get((request.body as any).filter.arguments.value);
|
||||
if (failOnCompare) {
|
||||
thing!.origin!.modified = 'altered';
|
||||
}
|
||||
const returnThing = failOnLookup ? [] : [thing];
|
||||
const returnBody = {
|
||||
data: returnThing,
|
||||
facets: [],
|
||||
pagination: {
|
||||
count: returnThing.length,
|
||||
offset: 0,
|
||||
total: returnThing.length,
|
||||
},
|
||||
stats: {
|
||||
time: 42,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
body: returnBody,
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: searchRoute.statusCodeSuccess,
|
||||
};
|
||||
});
|
||||
|
||||
await endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.eventually.have.length(0);
|
||||
|
||||
failOnLookup = true;
|
||||
failOnCompare = false;
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {
|
||||
await endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.eventually.include(
|
||||
@@ -161,8 +158,7 @@ describe('e2e Connector', function () {
|
||||
|
||||
failOnLookup = false;
|
||||
failOnCompare = true;
|
||||
// tslint:disable-next-line: max-line-length
|
||||
await e2eRun(httpClient, {
|
||||
await endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.eventually.include('Unexpected difference between original and retrieved sample');
|
||||
@@ -171,15 +167,14 @@ describe('e2e Connector', function () {
|
||||
it('should fail to index', async function () {
|
||||
type responses = HttpClientResponse<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse>;
|
||||
|
||||
sandbox.on(httpClient, 'request', async (): Promise<RecursivePartial<responses>> => {
|
||||
sandbox.on(httpClient, 'request', async (): Promise<Partial<responses>> => {
|
||||
return {
|
||||
body: {},
|
||||
statusCode: Number.MAX_SAFE_INTEGER,
|
||||
};
|
||||
});
|
||||
|
||||
// tslint:disable-next-line: max-line-length
|
||||
return e2eRun(httpClient, {
|
||||
return endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: './node_modules/@openstapps/core/test/resources',
|
||||
}).should.eventually.include('');
|
||||
@@ -190,7 +185,7 @@ describe('e2e Connector', function () {
|
||||
if (!existsSync(emptyDirectoryPath)) {
|
||||
mkdirSync(emptyDirectoryPath);
|
||||
}
|
||||
await e2eRun(httpClient, {
|
||||
await endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: emptyDirectoryPath,
|
||||
}).should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
@@ -207,7 +202,7 @@ describe('e2e Connector', function () {
|
||||
}
|
||||
const nonJsonFile = path.join(somewhatFilledDirectoryPath, 'nonjson.txt');
|
||||
createFileSync(nonJsonFile);
|
||||
await e2eRun(httpClient, {
|
||||
await endToEndRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: somewhatFilledDirectoryPath,
|
||||
}).should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
@@ -50,11 +50,10 @@
|
||||
"dockerode": "3.3.5",
|
||||
"is-cidr": "4.0.2",
|
||||
"mustache": "4.2.0",
|
||||
"semver": "7.5.4",
|
||||
"typescript": "5.1.6"
|
||||
"semver": "7.3.8",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/api-cli": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
@@ -65,7 +64,7 @@
|
||||
"@types/mustache": "4.2.2",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/proxyquire": "1.3.28",
|
||||
"@types/semver": "7.5.6",
|
||||
"@types/semver": "7.3.13",
|
||||
"@types/sha1": "1.1.3",
|
||||
"@types/sinon": "10.0.14",
|
||||
"@types/sinon-chai": "3.2.9",
|
||||
@@ -76,7 +75,7 @@
|
||||
"sinon": "15.0.4",
|
||||
"sinon-chai": "3.7.0",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0"
|
||||
"tsup": "7.2.0"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
"devDependencies": {
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@types/node": "18.15.3",
|
||||
"eslint": "8.43.0",
|
||||
"typescript": "5.1.6"
|
||||
"eslint": "8.53.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.60.1",
|
||||
"@typescript-eslint/parser": "5.60.1",
|
||||
"eslint": "8.43.0",
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-plugin-jsdoc": "46.4.2",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"eslint-plugin-unicorn": "47.0.0"
|
||||
"@typescript-eslint/eslint-plugin": "6.10.0",
|
||||
"@typescript-eslint/parser": "6.10.0",
|
||||
"eslint": "8.53.0",
|
||||
"eslint-config-prettier": "9.0.0",
|
||||
"eslint-plugin-jsdoc": "46.8.2",
|
||||
"eslint-plugin-prettier": "5.0.1",
|
||||
"eslint-plugin-unicorn": "49.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/** @type {import('prettier').Config} */
|
||||
const config = {
|
||||
tabWidth: 2,
|
||||
printWidth: 110,
|
||||
useTabs: false,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
quoteProps: 'consistent',
|
||||
trailingComma: 'all',
|
||||
bracketSpacing: false,
|
||||
arrowParens: 'avoid',
|
||||
endOfLine: 'lf'
|
||||
}
|
||||
|
||||
export default config;
|
||||
13
configuration/prettier-config/index.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/prettierrc",
|
||||
"tabWidth": 2,
|
||||
"printWidth": 110,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"quoteProps": "consistent",
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
@@ -9,17 +9,14 @@
|
||||
"contributors": [
|
||||
"Rainer Killinger <mail-openstapps@killinger.co>"
|
||||
],
|
||||
"main": "index.js",
|
||||
"main": "index.json",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.json",
|
||||
"CHANGELOG.md",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "prettier --config index.js --check \"test/*.js\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "3.1.0"
|
||||
"test": "npx prettier --config index.json --check \"test/*.js\""
|
||||
},
|
||||
"peerDependencies": {
|
||||
"prettier": "3.1.0"
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
"mocha": "10.2.0",
|
||||
"mocha-junit-reporter": "2.2.0",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "5.1.6"
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"alwaysStrict": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
@@ -14,6 +15,7 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"isolatedModules": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noImplicitAny": true,
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
# @openstapps/minimal-connector
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @openstapps/api@3.1.1
|
||||
- @openstapps/core@3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8ca10]
|
||||
- @openstapps/core@3.1.0
|
||||
- @openstapps/api@3.1.0
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openstapps/minimal-connector",
|
||||
"description": "This is a minimal connector which serves as an example",
|
||||
"version": "3.1.1",
|
||||
"version": "3.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
@@ -38,7 +38,6 @@
|
||||
"commander": "10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openstapps/core-tools": "workspace:*",
|
||||
"@openstapps/eslint-config": "workspace:*",
|
||||
"@openstapps/prettier-config": "workspace:*",
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
@@ -54,8 +53,8 @@
|
||||
"mocha-junit-reporter": "2.2.0",
|
||||
"nock": "13.3.1",
|
||||
"ts-node": "10.9.1",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "5.1.6"
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
|
||||
@@ -1,23 +1,5 @@
|
||||
# @openstapps/minimal-plugin
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @openstapps/api@3.1.1
|
||||
- @openstapps/api-plugin@3.1.1
|
||||
- @openstapps/core@3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8ca10]
|
||||
- @openstapps/core@3.1.0
|
||||
- @openstapps/api@3.1.0
|
||||
- @openstapps/api-plugin@3.1.0
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openstapps/minimal-plugin",
|
||||
"description": "Minimal Plugin",
|
||||
"version": "3.1.1",
|
||||
"version": "3.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
@@ -31,7 +31,7 @@
|
||||
"@openstapps/api": "workspace:*",
|
||||
"@openstapps/api-plugin": "workspace:*",
|
||||
"@openstapps/core": "workspace:*",
|
||||
"@openstapps/core-tools": "workspace:*",
|
||||
"@openstapps/json-schema-generator": "workspace:*",
|
||||
"@openstapps/logger": "workspace:*",
|
||||
"commander": "10.0.0",
|
||||
"express": "4.18.2",
|
||||
@@ -43,17 +43,8 @@
|
||||
"@openstapps/tsconfig": "workspace:*",
|
||||
"@types/express": "4.17.17",
|
||||
"@types/node": "18.15.3",
|
||||
"tsup": "6.7.0",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/app.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
"tsup": "7.2.0",
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
import {HttpClient} from '@openstapps/api';
|
||||
import {PluginClient} from '@openstapps/api-plugin';
|
||||
import {Converter} from '@openstapps/core-tools';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import {Command, Option} from 'commander';
|
||||
import {readFileSync} from 'fs';
|
||||
@@ -52,18 +51,11 @@ const pluginClient = new PluginClient(new HttpClient(), options.backendUrl);
|
||||
|
||||
// create an instance of your plugin
|
||||
const plugin = new MinimalPlugin(
|
||||
// tslint:disable-next-line:no-magic-numbers
|
||||
Number.parseInt(options.port, 10),
|
||||
options.pluginName,
|
||||
options.url,
|
||||
`/${options.routeName}`,
|
||||
options.backendUrl,
|
||||
new Converter(path.resolve(__dirname, '..', 'src', 'plugin', 'protocol')), // an instance of the converter. Required
|
||||
// because your requests and response schemas are defined in the plugin. The path should lead to your request and
|
||||
// response interfaces
|
||||
'SCMinimalRequest', // TODO: adjust name of the request interface
|
||||
'SCMinimalResponse', // TODO: adjust name of the response interface
|
||||
JSON.parse(readFileSync(path.resolve(__dirname, '..', 'package.json')).toString()).version, // get the version of the plugin from the package.json
|
||||
);
|
||||
|
||||
pluginClient
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
import {Plugin} from '@openstapps/api-plugin';
|
||||
import * as express from 'express';
|
||||
import {SCMinimalRequest} from './protocol/request.js';
|
||||
import {SCMinimalResponse} from './protocol/response.js';
|
||||
import {requestSchema, SCMinimalRequest} from './protocol/request.js';
|
||||
import {responseSchema, SCMinimalResponse} from './protocol/response.js';
|
||||
|
||||
/**
|
||||
* The Plugin Class
|
||||
@@ -24,6 +24,10 @@ import {SCMinimalResponse} from './protocol/response.js';
|
||||
* TODO: rename the class
|
||||
*/
|
||||
export class MinimalPlugin extends Plugin {
|
||||
requestSchema = requestSchema;
|
||||
|
||||
responseSchema = responseSchema;
|
||||
|
||||
/**
|
||||
* Calculates the sum of a list of numbers
|
||||
*
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
/**
|
||||
* The Request Interface
|
||||
*
|
||||
* All incoming requests will look like this, this is being checked by the backend. You need to add the @validatable tag
|
||||
* like shown below for the plugin to work. The request can have any layout you like.
|
||||
* All incoming requests will look like this, this is being checked by the backend.
|
||||
* The request can have any layout you like.
|
||||
* TODO: remove body of the interface and replace with your own layout
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCMinimalRequest {
|
||||
/**
|
||||
@@ -27,3 +26,5 @@ export interface SCMinimalRequest {
|
||||
*/
|
||||
numbers: number[];
|
||||
}
|
||||
|
||||
export {default as requestSchema} from 'schema:#SCMinimalRequest';
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* All your responses to the backend are required to look like this. You need to add the @validatable tag like shown
|
||||
* below for the plugin to work. The response can have any layout you like.
|
||||
* TODO: remove body of the interface and replace with your own layout
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCMinimalResponse {
|
||||
/**
|
||||
@@ -27,3 +26,5 @@ export interface SCMinimalResponse {
|
||||
*/
|
||||
sum: number;
|
||||
}
|
||||
|
||||
export {default as responseSchema} from 'schema:#SCMinimalResponse';
|
||||
|
||||
5
examples/minimal-plugin/src/schemas.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare module 'schema:*' {
|
||||
import {JSONSchema7} from 'json-schema';
|
||||
const schema: JSONSchema7;
|
||||
export default schema;
|
||||
}
|
||||
12
examples/minimal-plugin/tsup.config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
import {jsonSchemaPlugin} from '@openstapps/json-schema-generator';
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/app.ts'],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
format: 'esm',
|
||||
outDir: 'lib',
|
||||
noExternal: [/.*:schema#.*/],
|
||||
plugins: [jsonSchemaPlugin('schema.json')],
|
||||
});
|
||||
6
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1701626906,
|
||||
"narHash": "sha256-ugr1QyzzwNk505ICE4VMQzonHQ9QS5W33xF2FXzFQ00=",
|
||||
"lastModified": 1698553279,
|
||||
"narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0c6d8c783336a59f4c59d4a6daed6ab269c4b361",
|
||||
"rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
webkit = prev.epiphany; # Safari-ish browser
|
||||
android = prev.androidenv.composeAndroidPackages {
|
||||
buildToolsVersions = [ "${buildToolsVersion}" ];
|
||||
platformVersions = [ "33" ];
|
||||
platformVersions = [ "32" ];
|
||||
};
|
||||
cypress = prev.cypress.overrideAttrs(cyPrev: rec {
|
||||
version = "13.2.0";
|
||||
|
||||
1
frontend/app/.gitignore
vendored
@@ -37,7 +37,6 @@ resources/*/icon/
|
||||
resources/*/splash/
|
||||
android/app/src/main/res/**/*.png
|
||||
ios/App/App/Assets.xcassets/**/*.png
|
||||
AndroidManifest.xml.orig
|
||||
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
@@ -45,4 +45,5 @@ UserInterfaceState.xcuserstate
|
||||
android/
|
||||
ios/
|
||||
|
||||
.browser-data
|
||||
docs
|
||||
|
||||
@@ -13,10 +13,14 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {SCThings} from '@openstapps/core';
|
||||
|
||||
export abstract class SearchProvider {
|
||||
abstract fetchAndUpdateItems(append: boolean): Promise<void> | void;
|
||||
|
||||
abstract route(item: SCThings): Promise<void> | void;
|
||||
}
|
||||
module.exports = {
|
||||
...require('@openstapps/prettier-config'),
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.html'],
|
||||
options: {
|
||||
parser: 'angular',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,36 +1,5 @@
|
||||
# @openstapps/app
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix version history offered by backend
|
||||
- Updated dependencies
|
||||
- @openstapps/api@3.1.1
|
||||
- @openstapps/core@3.1.1
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- last minute deployment changes
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8ca10: Add job portal feature
|
||||
- 066e3744: Update to Capacitor 5.x
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 066e3744: Update logo flow to use capacitor-assets (single asset)
|
||||
- 066e3744: Replace NavigationBar/StatusBar plugins with native color setting
|
||||
- 066e3744: Hide splash screen only when app is ready
|
||||
- Updated dependencies [06b8ca10]
|
||||
- @openstapps/core@3.1.0
|
||||
- @openstapps/api@3.1.0
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
namespace "de.anyschool.app"
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "de.anyschool.app"
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
android {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ dependencies {
|
||||
implementation project(':capacitor-preferences')
|
||||
implementation project(':capacitor-share')
|
||||
implementation project(':capacitor-splash-screen')
|
||||
implementation project(':capacitor-status-bar')
|
||||
implementation project(':hugotomazi-capacitor-navigation-bar')
|
||||
implementation project(':transistorsoft-capacitor-background-fetch')
|
||||
implementation project(':capacitor-secure-storage-plugin')
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.anyschool.app">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -8,14 +10,16 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout"
|
||||
android:exported="true"
|
||||
android:label="@string/title_activity_main"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
android:name="de.anyschool.app.MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||
android:launchMode="singleTask"
|
||||
android:exported="true"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -33,14 +37,20 @@
|
||||
<data android:host="@string/app_host" android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true"
|
||||
android:name="androidx.core.content.FileProvider">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"></meta-data>
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
||||
@@ -55,6 +55,14 @@
|
||||
"pkg": "@capacitor/splash-screen",
|
||||
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@capacitor/status-bar",
|
||||
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@hugotomazi/capacitor-navigation-bar",
|
||||
"classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin"
|
||||
},
|
||||
{
|
||||
"pkg": "@transistorsoft/capacitor-background-fetch",
|
||||
"classpath": "com.transistorsoft.bgfetch.capacitor.BackgroundFetchPlugin"
|
||||
|
||||
|
Before Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
||||
@@ -1,27 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<group android:scaleX="0.649"
|
||||
android:scaleY="0.649"
|
||||
android:translateX="176.63525"
|
||||
android:translateY="179.712">
|
||||
<path
|
||||
android:pathData="M272.4,232.1L483.6,232.1A38,38 0,0 1,521.6 270.2L521.6,481.4A38,38 0,0 1,483.6 519.4L272.4,519.4A38,38 0,0 1,234.4 481.4L234.4,270.2A38,38 0,0 1,272.4 232.1z"
|
||||
android:strokeWidth="0.839386"
|
||||
android:fillColor="#00b5cc"/>
|
||||
<path
|
||||
android:pathData="M584.2,402.8L662,402.8A19.4,19.4 0,0 1,681.4 422.2L681.4,499.9A19.4,19.4 0,0 1,662 519.4L584.2,519.4A19.4,19.4 0,0 1,564.8 499.9L564.8,422.2A19.4,19.4 0,0 1,584.2 402.8z"
|
||||
android:strokeWidth="0.842212"
|
||||
android:fillColor="#3be40b"/>
|
||||
<path
|
||||
android:pathData="M591.8,562.6L769.3,562.6A27,27 0,0 1,796.3 589.6L796.3,767A27,27 0,0 1,769.3 794.1L591.8,794.1A27,27 0,0 1,564.8 767L564.8,589.6A27,27 0,0 1,591.8 562.6z"
|
||||
android:strokeWidth="0.832623"
|
||||
android:fillColor="#c90e20"/>
|
||||
<path
|
||||
android:pathData="M371.2,562.6L496.3,562.6A25.3,25.3 0,0 1,521.6 587.9L521.6,713A25.3,25.3 0,0 1,496.3 738.3L371.2,738.3A25.3,25.3 0,0 1,345.9 713L345.9,587.9A25.3,25.3 0,0 1,371.2 562.6z"
|
||||
android:strokeWidth="0.846446"
|
||||
android:fillColor="#e4a20b"/>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorBackground">#000</color>
|
||||
</resources>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimary</item>
|
||||
<item name="android:windowBackground">@color/colorPrimary</item>
|
||||
<item name="android:navigationBarColor">@color/colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||