Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results
Show changes
Commits on Source (7)
Showing
with 333 additions and 81 deletions
<a name="v3.4.2"></a>
## [v3.4.2] - 2023-01-15
### Bug Fixes
- error in the status processing
### Changes
- update makefiles
- update makefiles
- doc
<a name="v3.4.1"></a>
## [v3.4.1] - 2023-01-08
### Bug Fixes
......@@ -177,6 +188,7 @@
<a name="1.8.0"></a>
## 1.8.0 - 2021-08-15
[v3.4.2]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.4.1...v3.4.2
[v3.4.1]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.4.0...v3.4.1
[v3.4.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.3.0...v3.4.0
[v3.3.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.2.0...v3.3.0
......
......@@ -40,13 +40,20 @@ MAKEFILE_IMPORT_PATH?=$(PROJECT_ROOT)makefiles/
#############################################################################################
include $(MAKEFILE_IMPORT_PATH)directories-standard.mk
#include $(MAKEFILE_IMPORT_PATH)directories-go-lib.mk
#include $(MAKEFILE_IMPORT_PATH)directories-go-utilities.mk
#include $(MAKEFILE_IMPORT_PATH)directories-platform-part.mk
include $(MAKEFILE_IMPORT_PATH)jsdoc.mk
include $(MAKEFILE_IMPORT_PATH)output.mk
include $(MAKEFILE_IMPORT_PATH)placeholder.mk
include $(MAKEFILE_IMPORT_PATH)conan.mk
#include $(MAKEFILE_IMPORT_PATH)bob.mk
include $(MAKEFILE_IMPORT_PATH)s3.mk
#include $(MAKEFILE_IMPORT_PATH)readme-standard.mk
include $(MAKEFILE_IMPORT_PATH)readme-webcomponents.mk
#include $(MAKEFILE_IMPORT_PATH)readme-go-utilities.mk
#include $(MAKEFILE_IMPORT_PATH)readme-go-lib.mk
#include $(MAKEFILE_IMPORT_PATH)readme-platform-part.mk
include $(MAKEFILE_IMPORT_PATH)licenses.mk
include $(MAKEFILE_IMPORT_PATH)license-agpl3.mk
#include $(MAKEFILE_IMPORT_PATH)license-unlicensed.mk
......@@ -70,18 +77,28 @@ include $(MAKEFILE_IMPORT_PATH)target-jsdoc-build.mk
#include $(MAKEFILE_IMPORT_PATH)target-docman.mk
#include $(MAKEFILE_IMPORT_PATH)target-caddy.mk
include $(MAKEFILE_IMPORT_PATH)target-conan.mk
#include $(MAKEFILE_IMPORT_PATH)target-bob.mk
#include $(MAKEFILE_IMPORT_PATH)target-phpunit.mk
#include $(MAKEFILE_IMPORT_PATH)target-jekyll.mk
include $(MAKEFILE_IMPORT_PATH)target-update-makefiles.mk
include $(MAKEFILE_IMPORT_PATH)target-help.mk
#include $(MAKEFILE_IMPORT_PATH)target-go-build.mk
include $(MAKEFILE_IMPORT_PATH)target-node-build.mk
include $(MAKEFILE_IMPORT_PATH)target-node-test.mk
include $(MAKEFILE_IMPORT_PATH)target-npm-publish.mk
#include $(MAKEFILE_IMPORT_PATH)target-npm.mk
include $(MAKEFILE_IMPORT_PATH)target-git.mk
#include $(MAKEFILE_IMPORT_PATH)target-init-standard.mk
#include $(MAKEFILE_IMPORT_PATH)target-init-webcomponent.mk
#include $(MAKEFILE_IMPORT_PATH)target-init-go-utilities.mk
#include $(MAKEFILE_IMPORT_PATH)target-init-go-lib.mk
#include $(MAKEFILE_IMPORT_PATH)target-init-platform-part.mk
include $(MAKEFILE_IMPORT_PATH)target-version.mk
include $(MAKEFILE_IMPORT_PATH)target-variable.mk
include $(MAKEFILE_IMPORT_PATH)terminal-check.mk
#############################################################################################
# include target-project.mk only if it exists
-include $(MAKEFILE_IMPORT_PATH)target-project.mk
import {RestAPI} from '@schukai/monster/source/data/datasource/server/restapi.mjs';
const ds = new RestAPI({
write: {
url: 'https://httpbin.org/get'
},
read: {
url: 'https://httpbin.org/get'
}
});
ds.set({flag: true})
ds.write().then(() => console.log('done'));
ds.read().then(() => console.log('done'));
\ No newline at end of file
import {RestAPI} from '@schukai/monster/source/data/datasource/restapi.mjs';
import {WebConnect} from '@schukai/monster/source/data/datasource/server/webconnect.mjs';
const ds = new RestAPI({
const ds = new WebConnect({
url: 'https://httpbin.org/get'
}, {
url: 'https://httpbin.org/post'
});
ds.set({flag: true})
......
import {WebConnect} from '@schukai/monster/source/net/webconnect.mjs';
const connection = new WebConnect({
url: 'https://httpbin.org/get'
});
connection.connect().then(()=>{
connection.send({message:"Hello World!"}).then((response)=>{
console.log(response);
});
const message = connection.poll()
})
{
"name": "@schukai/monster",
"version": "3.4.0",
"version": "3.4.1",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......
......@@ -17,7 +17,7 @@ export {RestAPI}
/**
* The RestAPI is a class that enables a REST API server.
*
* @externalExample ../../../example/data/storage/restapi.mjs
* @externalExample ../../../../example/data/datasource/server/restapi.mjs
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
......@@ -114,44 +114,17 @@ class RestAPI extends Server {
* @throws {Error} the data cannot be read
*/
read() {
const self = this;
let response;
let init = self.getOption('read.init');
if (!isObject(init)) init = {};
if (!init['method']) init['method'] = 'GET';
return new Promise((resolve, reject) => {
fetch(self.getOption('read.url'), init).then(resp => {
response = resp;
const acceptedStatus = self.getOption('read.acceptedStatus', [200]);
if (acceptedStatus.indexOf(resp.status) === -1) {
throw Error('the data cannot be read (response ' + resp.status + ')')
}
return resp.text()
}).then(body => {
let obj;
try {
obj = JSON.parse(body);
} catch (e) {
if (body.length > 100) {
body = body.substring(0, 97) + '...';
}
throw new Error('the response does not contain a valid json (actual: ' + body + ').');
}
return fetchData.call(this, 'read', (obj) => {
self.set(self.transformServerPayload.call(self, obj));
resolve(response);
}).catch(reject);
});
})
}
/**
......@@ -159,6 +132,7 @@ class RestAPI extends Server {
* @throws {WriteError} the data cannot be written
*/
write() {
const self = this;
let init = self.getOption('write.init');
......@@ -168,60 +142,65 @@ class RestAPI extends Server {
'Content-Type': 'application/json'
}
}
if (!init['method']) init['method'] = 'POST';
let obj = self.prepareServerPayload(self.get());
init['body'] = JSON.stringify(obj);
return new Promise((resolve, reject) => {
fetch(self.getOption('write.url'), init).then(response => {
const acceptedStatus = self.getOption('write.acceptedStatus', [200, 201]);
if (acceptedStatus.indexOf(response.status) > -1) {
reject(response);
return;
return fetchData.call(this, init, 'write');
}
response.text().then((body) => {
let obj = {}, validation = {};
try {
obj = JSON.parse(body);
/**
* @return {RestAPI}
*/
getClone() {
const self = this;
return new RestAPI(self[internalSymbol].getRealSubject()['options'].read, self[internalSymbol].getRealSubject()['options'].write);
}
if (reportPath) {
validation = (new Pathfinder(obj)).getVia(reportPath);
}
} catch (e) {
function fetchData(init, key, callback) {
if (body.length > 100) {
body = body.substring(0, 97) + '...';
}
const self = this;
let response;
reject(new Error('the response does not contain a valid json (actual: ' + body + ').'));
return;
}
reject(new WriteError('the data cannot be written (response ' + response.status + ')', response, validation))
return;
return fetch(self.getOption(key + '.url'), init).then(resp => {
response = resp;
const acceptedStatus = self.getOption(key + '.acceptedStatus', [200]);
if (acceptedStatus.indexOf(resp.status) === -1) {
throw Error('the data cannot be ' + key + ' (response ' + resp.status + ')')
}
}).catch(reject);
return resp.text()
}).then(body => {
let obj;
}).catch(reject);
try {
obj = JSON.parse(body);
})
} catch (e) {
if (body.length > 100) {
body = body.substring(0, 97) + '...';
}
throw new Error('the response does not contain a valid json (actual: ' + body + ').');
}
/**
* @return {RestAPI}
*/
getClone() {
const self = this;
return new RestAPI(self[internalSymbol].getRealSubject()['options'].read, self[internalSymbol].getRealSubject()['options'].write);
if (callback && isFunction(callback)) {
callback(obj);
}
return response;
});
}
......
......@@ -26,7 +26,7 @@ const webConnectSymbol = Symbol("connection");
/**
* The RestAPI is a class that enables a REST API server.
*
* @externalExample ../../../example/data/storage/restapi.mjs
* @externalExample ../../../../example/data/datasource/server/webconnect.mjs
* @license AGPLv3
* @since 3.1.0
* @copyright schukai GmbH
......
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* In this namespace you will find classes and methods for handling connections.
*
* @namespace Monster.Net
* @memberOf Monster
* @author schukai GmbH
*/
const ns = {};
\ No newline at end of file
......@@ -158,18 +158,18 @@ function connectServer(resolve, reject) {
/**
* The RestAPI is a class that enables a REST API server.
*
* @externalExample ../../../example/data/storage/restapi.mjs
* @externalExample ../../example/net/webconnect.mjs
* @license AGPLv3
* @since 3.1.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource
* @memberOf Monster.Net
* @summary The LocalStorage class encapsulates the access to data objects.
*/
class WebConnect extends BaseWithOptions {
/**
*
* @param {Object} [options] options contains definitions for the datasource.
* @param {Object} [options] options contains definitions for the webconnect.
*/
constructor(options) {
......
......@@ -14,6 +14,12 @@ const dataSymbol = Symbol("@@data");
/**
* This class represents a WebSocket message.
*
* @license AGPLv3
* @since 3.4.0
* @copyright schukai GmbH
* @memberOf Monster.Net.WebSocket
* @summary The Message class encapsulates a WebSocket message.
*/
class Message extends Base {
......
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* In this namespace you will find classes and methods for handling data.
*
* @namespace Monster.Net.WebConnect
* @memberOf Monster.Net
* @author schukai GmbH
*/
const ns = {};
\ No newline at end of file
......@@ -149,7 +149,7 @@ function getMonsterVersion() {
}
/** don't touch, replaced by make with package.json version */
monsterVersion = new Version('3.4.0')
monsterVersion = new Version('3.4.1')
return monsterVersion;
......
#############################################################################################
#############################################################################################
##
## DEFINE BOB
##
#############################################################################################
#############################################################################################
BOB_BIN ?= $(VENDOR_PATH)bob
#BOB_SNIPPED_CONFIG ?= $(VENDOR_PATH)bob/snippet.yaml
BOB_SYNC_CONFIG ?= $(VENDOR_PATH)bob/sync.yaml
BOB_BUILD_PATH ?= $(BUILD_PATH)bob/build/
BOB_DIST_PATH ?= $(DIST_PATH)bob/dist/
define SYNCEXAMPLECONF
sync:
- source:
path: '../original/test1.html'
selector: '#mainscript'
destination:
path: '../original/'
exclude:
- ../original/test1.html
- source:
path: '../original/test1.html'
selector: '.deco'
destination:
path: '../original/'
exclude:
- ../original/test1.html
endef
export SYNCEXAMPLECONF
define SNIPPETEXAMPLECONF
snippet:
-
source: ../../template.html
selector: 'h1'
destination: ../../snippets/meta/container.html
attribute:
- selector: 'li'
name: 'data-state'
value: 'monster'
replacement:
-
selector: 'li>span'
content: 'hello'
endef
export SNIPPETEXAMPLECONF
$(BOB_SNIPPED_CONFIG):
$(QUIET) $(ECHO) "$$BOB_SNIPPED_CONFIG" >> $@
$(BOB_SYNC_CONFIG):
$(QUIET) $(ECHO) "$$BOB_SYNC_CONFIG" >> $@
......@@ -17,8 +17,10 @@ endif
ifeq ($(GIT_CHGLOG_BIN),)
$(shell $(GO) install github.com/git-chglog/git-chglog/cmd/git-chglog@latest)
GIT_CHGLOG_BIN := $(shell command -v git-chglog 2> /dev/null)
endif
ifneq ($(shell test -d $(GIT_CHGLOG_CONFIG_DIR) && echo -n yes),yes)
$(shell mkdir -p $(GIT_CHGLOG_CONFIG_DIR))
endif
......@@ -95,7 +97,7 @@ endef
export GIT_CHGLOG_CONFIG_FILE
$(GIT_CHGLOG_CONFIG_DIR)/config.yml:
$(QUITE) $(ECHO) "$$GIT_CHGLOG_CONFIG_FILE" >> $@
$(QUIET) $(ECHO) "$$GIT_CHGLOG_CONFIG_FILE" >> $@
define GIT_CHGLOG_CONFIG_TEMPLATE
{{ range .Versions }}
......@@ -131,7 +133,7 @@ export GIT_CHGLOG_CONFIG_TEMPLATE
$(GIT_CHGLOG_CONFIG_DIR)/CHANGELOG.tpl.md:
$(QUITE) $(ECHO) "$$GIT_CHGLOG_CONFIG_TEMPLATE" >> $@
$(QUIET) $(ECHO) "$$GIT_CHGLOG_CONFIG_TEMPLATE" >> $@
## location of CHANGELOG.md file
CHANGELOG_FILE ?= $(PROJECT_ROOT)CHANGELOG.md
......
......@@ -47,5 +47,5 @@ endef
export CONANEXAMPLECONF
$(CONAN_CONFIG):
$(QUITE) $(ECHO) "$$CONANEXAMPLECONF" >> $@
$(QUIET) $(ECHO) "$$CONANEXAMPLECONF" >> $@
#############################################################################################
#############################################################################################
##
## DIRECTORIES
##
#############################################################################################
#############################################################################################
APPLICATION_PATH ?= $(PROJECT_ROOT)
DEPLOYMENT_PATH ?= $(PROJECT_ROOT)
DEVELOPMENT_PATH ?= $(PROJECT_ROOT)
DOCUMENTATION_PATH ?= $(PROJECT_ROOT)
RESOURCE_PATH ?= $(APPLICATION_PATH)
SOURCE_PATH ?= $(APPLICATION_PATH)
## SCRIPTS_PATH IS DEPRECATED
SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
DEVELOPMENT_SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
BUILD_PATH ?= $(DEPLOYMENT_PATH)build/
VENDOR_PATH ?= $(DEPLOYMENT_PATH)vendor/
DEPLOYMENT_SCRIPTS_PATH ?= $(DEPLOYMENT_PATH)script/
LICENSE_PATH ?= $(PROJECT_ROOT)
PROJECT_DIRECTORIES := $(PROJECT_DIRECTORIES) \
$(APPLICATION_PATH) \
$(VENDOR_PATH) \
$(DEVELOPMENT_SCRIPTS_PATH) \
$(BUILD_PATH)
#############################################################################################
#############################################################################################
##
## DIRECTORIES
##
#############################################################################################
#############################################################################################
APPLICATION_PATH ?= $(PROJECT_ROOT)application/
DEPLOYMENT_PATH ?= $(PROJECT_ROOT)deployment/
DEVELOPMENT_PATH ?= $(PROJECT_ROOT)development/
DOCUMENTATION_PATH ?= $(PROJECT_ROOT)documentation/
RESOURCE_PATH ?= $(APPLICATION_PATH)resource/
SOURCE_PATH ?= $(APPLICATION_PATH)source/
WEB_PATH ?= $(APPLICATION_PATH)web/
## SCRIPTS_PATH IS DEPRECATED
SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
DEVELOPMENT_SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
BUILD_PATH ?= $(DEPLOYMENT_PATH)build/
VENDOR_PATH ?= $(DEPLOYMENT_PATH)vendor/
DEPLOYMENT_SCRIPTS_PATH ?= $(DEPLOYMENT_PATH)script/
LICENSE_PATH ?= $(PROJECT_ROOT)
PROJECT_DIRECTORIES := $(PROJECT_DIRECTORIES) \
$(APPLICATION_PATH) \
$(RESOURCE_PATH) \
$(SOURCE_PATH) \
$(DEPLOYMENT_PATH) \
$(VENDOR_PATH) \
$(DEVELOPMENT_PATH) \
$(DEVELOPMENT_SCRIPTS_PATH) \
$(DEPLOYMENT_SCRIPTS_PATH) \
$(DOCUMENTATION_PATH) \
$(LICENSE_PATH) \
$(BUILD_PATH)
#############################################################################################
#############################################################################################
##
## DIRECTORIES
##
#############################################################################################
#############################################################################################
SOURCE_PATH ?= $(PROJECT_ROOT)source/
RELATIVE_SCRIPT_PATH ?= script/
SCRIPT_PATH ?= $(PROJECT_ROOT)$(RELATIVE_SCRIPT_PATH)
VENDOR_PATH ?= $(PROJECT_ROOT)vendor/
NODE_PATH ?= $(PROJECT_ROOT)node_modules/
TEST_PATH ?= $(PROJECT_ROOT)test/
DEVELOPMENT_PATH ?= $(PROJECT_ROOT)
LICENSE_PATH ?= $(PROJECT_ROOT)
DIST_PATH ?= $(PROJECT_ROOT)dist/
CONFIG_PATH ?= $(PROJECT_ROOT)config/
BUILD_PATH ?= $(PROJECT_ROOT)build/
BOB_SNIPPED_CONFIG ?= $(CONFIG_PATH)snippet.conf
BOB_SYNC_CONFIG ?= $(CONFIG_PATH)sync.yaml
BOB_BUILD_PATH ?= $(BUILD_PATH)
BOB_DIST_PATH ?= $(DIST_PATH)
PROJECT_DIRECTORIES := $(PROJECT_DIRECTORIES) \
$(SOURCE_PATH) \
$(SCRIPT_PATH) \
$(VENDOR_PATH) \
$(NODE_PATH) \
$(TEST_PATH) \
$(LICENSE_PATH) \
$(CONFIG_PATH) \
$(BUILD_PATH) \
$(DIST_PATH)