Compare commits
44 Commits
1541018701
...
master
Author | SHA1 | Date | |
---|---|---|---|
5d9f4754a5 | |||
2cac260954 | |||
d298b8e842 | |||
bd63607477 | |||
55d461fb8e | |||
895893e76a | |||
39fbc73c74 | |||
e1c26e2c5e | |||
d3a93108e2 | |||
7a79aca59b | |||
ffb086a774 | |||
d1499bb6d4 | |||
a6d4a35588 | |||
2e4bb21354 | |||
3ed5253fc4 | |||
274f2b4b7a | |||
6eae1742d6 | |||
cc59df51d0 | |||
2a950310be | |||
9b4ad340a2 | |||
dfc0bc3b7e | |||
c2ea65a992 | |||
3de5485650 | |||
dfd3df544c | |||
7fe6dee81c | |||
1d7791c2b0 | |||
3c8dcf3ad2 | |||
ab70c46501 | |||
3af8b97258 | |||
431e21806b | |||
00546001eb | |||
db3ae308e6 | |||
20394e65f8 | |||
7b9ce83c71 | |||
27cec2cb0b | |||
a208a2fb50 | |||
52597ca46f | |||
efa44f0405 | |||
1a98e86954 | |||
ce4e78e0d5 | |||
bda39f279f | |||
111df45892 | |||
bff13c3364 | |||
6f242fb79f |
@ -2,7 +2,7 @@
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of Requestor which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, March 2020
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, March 2020
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
@ -12,6 +12,6 @@ module.exports = {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'@scode'
|
||||
'@sapphirecode'
|
||||
]
|
||||
}
|
||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -5,7 +5,7 @@ pipeline {
|
||||
VERSION = VersionNumber([
|
||||
versionNumberString:
|
||||
'${BUILDS_ALL_TIME}',
|
||||
versionPrefix: '1.1.',
|
||||
versionPrefix: '2.0.',
|
||||
worstResultForIncrement: 'SUCCESS'
|
||||
])
|
||||
}
|
||||
|
39
jenkins.js
39
jenkins.js
@ -1,33 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of Requestor which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, March 2020
|
||||
*/
|
||||
|
||||
/* eslint-disable no-process-exit */
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-sync */
|
||||
'use strict';
|
||||
|
||||
const https = require ('https');
|
||||
const fs = require ('fs');
|
||||
const child_process = require ('child_process');
|
||||
const { execSync: exec_sync } = require ('child_process');
|
||||
|
||||
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
|
||||
[
|
||||
,, pkg.version
|
||||
const run_file = fs.createWriteStream ('.jenkins.run.js');
|
||||
|
||||
const [
|
||||
,, ...args
|
||||
] = process.argv;
|
||||
fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2));
|
||||
|
||||
child_process.execSync ('yarn lint', { stdio: 'inherit' });
|
||||
if (typeof pkg.scripts !== 'undefined' && typeof pkg.scripts.test === 'string')
|
||||
child_process.execSync ('yarn test', { stdio: 'inherit' });
|
||||
run_file.on ('close', () => {
|
||||
exec_sync (`node .jenkins.run.js ${args.join (' ')}`, { stdio: 'inherit' });
|
||||
});
|
||||
|
||||
child_process.exec ('git log -1 | grep \'\\[no publish\\]\'')
|
||||
.addListener ('exit', (code) => {
|
||||
if (code === 0) {
|
||||
console.log ('build not marked for deployment');
|
||||
process.exit (1);
|
||||
https.get (
|
||||
'https://git.scode.ovh/Timo/standard/raw/branch/master/jenkins.run.js',
|
||||
(msg) => {
|
||||
msg.pipe (run_file);
|
||||
}
|
||||
else { child_process.execSync ('yarn publish'); }
|
||||
});
|
||||
);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
||||
* This file is part of Requestor which is released under BSD-3-Clause.
|
||||
* See file 'LICENSE' for full license details.
|
||||
* Created by Timo Hocker <timo@scode.ovh>, March 2020
|
||||
* Created by Timo Hocker <timo@sapphirecode.ovh>, March 2020
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
@ -12,6 +12,6 @@ module.exports = {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'@scode/eslint-config-ts'
|
||||
'@sapphirecode/eslint-config-ts'
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from 'express';
|
||||
import { http } from '@scode/consts';
|
||||
import { ControlModel, DatabaseModel } from '@scode/modelling';
|
||||
import { http } from '@sapphirecode/consts';
|
||||
import { ControlModel, DatabaseModel } from '@sapphirecode/modelling';
|
||||
import { CrudHandler } from './CrudHandler';
|
||||
import { HttpHandler } from './HttpHandler';
|
||||
import { DatabaseCrudOptionsReader } from './DatabaseCrudOptionsReader';
|
||||
@ -55,8 +55,7 @@ export class DatabaseCrudHandler extends HttpHandler implements CrudHandler {
|
||||
cm.update ();
|
||||
|
||||
const dm = new this.dm;
|
||||
for (const key of Object.keys (body_data))
|
||||
dm.set (key, cm.get (key));
|
||||
dm.assign (cm);
|
||||
await dm.write ();
|
||||
|
||||
res.status (http.status_created)
|
||||
@ -76,11 +75,11 @@ export class DatabaseCrudHandler extends HttpHandler implements CrudHandler {
|
||||
const dm = new this.dm (parseInt (req.headers.id as string));
|
||||
const found = await dm.read ();
|
||||
|
||||
const cm = new this.cm (dm.object);
|
||||
const cm = new this.cm (dm.get_data ());
|
||||
cm.update ();
|
||||
|
||||
res.status (found ? http.status_ok : http.status_not_found)
|
||||
.json (cm.object);
|
||||
.json (cm.get_data ());
|
||||
}
|
||||
|
||||
public async update (req: Request, res: Response): Promise<void> {
|
||||
@ -105,15 +104,13 @@ export class DatabaseCrudHandler extends HttpHandler implements CrudHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
const cm = new this.cm (dm.object);
|
||||
const cm = new this.cm (dm.get_data ());
|
||||
cm.update ();
|
||||
|
||||
for (const key of Object.keys (body_data))
|
||||
cm.set (key, body_data[key] as string|number|boolean);
|
||||
cm.assign_object (body_data);
|
||||
cm.update ();
|
||||
|
||||
for (const key of Object.keys (cm.object))
|
||||
dm.set (key, cm.get (key));
|
||||
dm.assign (cm);
|
||||
|
||||
const written = await dm.write ();
|
||||
|
||||
|
18
package.json
18
package.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@scode/requestor",
|
||||
"name": "@sapphirecode/requestor",
|
||||
"version": "1.0.0",
|
||||
"description": "Express handler templates",
|
||||
"main": "dist/index.js",
|
||||
@ -23,18 +23,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "^1.1.1",
|
||||
"@scode/eslint-config-ts": "^1.0.27",
|
||||
"@stryker-mutator/core": "^3.1.0",
|
||||
"@stryker-mutator/javascript-mutator": "^3.1.0",
|
||||
"ava": "^3.8.1",
|
||||
"@sapphirecode/eslint-config-ts": "^1.0.29",
|
||||
"eslint": "^6.8.0",
|
||||
"nyc": "^15.0.1",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scode/consts": "^1.1.7",
|
||||
"@scode/modelling": "^1.0.16",
|
||||
"@sapphirecode/consts": "^1.1.9",
|
||||
"@sapphirecode/modelling": "^1.0.19",
|
||||
"@types/express": "^4.17.6",
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"/dist/"
|
||||
]
|
||||
}
|
||||
|
1922
yarn-error.log
Normal file
1922
yarn-error.log
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user