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
Showing
with 391 additions and 309 deletions
import {getMonsterVersion} from '@schukai/monster/source/types/version.mjs';
getMonsterVersion();
\ No newline at end of file
import {Comparator} from '@schukai/monster/source/util/comparator.mjs';
console.log(new Comparator().lessThanOrEqual(2, 5))
// ↦ true
console.log(new Comparator().greaterThan(4, 2))
// ↦ true
console.log(new Comparator().equal(4, 4))
// ↦ true
console.log(new Comparator().equal(4, 5))
// ↦ false
import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
const deadmansswitch = new DeadMansSwitch(100, () => {
console.log('yeah!')
// ↦ "yeah!"
})
deadmansswitch.touch(); // from here wait again 100 ms
deadmansswitch.touch(200); // from here wait 200 ms
import {Processing} from '@schukai/monster/source/util/processing.mjs';
let startTime = +new Date();
new Processing((url) => {
return fetch(url)
}, (response) => {
// do something with the response
console.log(response.status, +new Date() - startTime)
}, 200, () => {
// this function is called 200 seconds after fetch is received.
console.log('finished', +new Date() - startTime)
return 'done'
}).run('https://monsterjs.org/assets/world.json').then(r => {
console.log(r)
// ↦ "done"
})
{
"name": "@schukai/%%NAME%%",
"version": "0.9.0",
"name": "@schukai/monster",
"version": "2.0.14",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......@@ -16,12 +16,27 @@
"core",
"shopcloud",
"alvine",
"monster"
"monster",
"buildmap",
"stack",
"observer",
"observable",
"uuid",
"node",
"nodelist",
"css-in-js",
"logger",
"log",
"theme"
],
"main": "source/monster.mjs",
"module": "source/monster.mjs",
"type": "module",
"homepage": "https://gitlab.schukai.com/oss/libraries/javascript/monster",
"main": "dist/monster.js",
"module": "dist/modules/monster.js",
"homepage": "https://monsterjs.org/",
"repository": {
"type": "git",
"url": "https://gitlab.schukai.com/oss/libraries/javascript/monster.git"
},
"author": "schukai GmbH",
"license": "AGPL 3.0"
}
'use strict';
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
import {Monster} from './namespace.js';
/**
* Property-Keys
* @author schukai GmbH
*/
export {
internalSymbol,
internalStateSymbol
}
/**
* @private
* @type {symbol}
* @memberOf Monster
* @license AGPLv3
* @since 1.24.0
*/
const internalSymbol = Symbol('internalData');
......@@ -18,14 +26,8 @@ const internalSymbol = Symbol('internalData');
* @private
* @type {symbol}
* @memberOf Monster
* @license AGPLv3
* @since 1.25.0
*/
const internalStateSymbol = Symbol('state');
export {
Monster,
internalSymbol,
internalStateSymbol
}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js';
import {Base} from '../types/base.mjs';
export {AbstractConstraint}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
......@@ -15,8 +16,9 @@ import {Base} from '../types/base.js';
*
* The abstract constraint defines the api for all constraints. mainly the method isValid() is defined.
*
* derived classes must implement the method isValid().
* Derived classes must implement the method isValid().
*
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -41,6 +43,3 @@ class AbstractConstraint extends Base {
return Promise.reject(value);
}
}
assignToNamespace('Monster.Constraints', AbstractConstraint);
export {Monster, AbstractConstraint}
\ No newline at end of file
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {AbstractConstraint} from "./abstract.js";
import {AbstractConstraint} from "./abstract.mjs";
export {AbstractOperator}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
*
* The uniform API of the constraints allows chains to be formed.
*
* Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.
* Operators allow you to link constraints together. for example, you can check whether a value is
* an object or an array. each operator has two operands that are linked together.
*
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -41,5 +46,3 @@ class AbstractOperator extends AbstractConstraint {
}
assignToNamespace('Monster.Constraints', AbstractOperator);
export {Monster, AbstractOperator}
\ No newline at end of file
/**
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {AbstractOperator} from "./abstractoperator.mjs";
export {AndOperator}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
*
* The uniform API of the constraints allows chains to be formed.
*
* The AndOperator is used to link several constraints. The constraint is fulfilled if all constraints of the operators are fulfilled.
*
* @externalExample ../../example/constraints/andoperator.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
* @summary A and operator constraint
*/
class AndOperator extends AbstractOperator {
/**
* this method return a promise containing the result of the check.
*
* @param {*} value
* @returns {Promise}
*/
isValid(value) {
return Promise.all([this.operantA.isValid(value), this.operantB.isValid(value)]);
}
}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {AbstractConstraint} from "./abstract.js";
import {AbstractConstraint} from "./abstract.mjs";
export {Invalid}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
......@@ -13,33 +16,8 @@ import {AbstractConstraint} from "./abstract.js";
*
* The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing.
*
* You can call the method via the monster namespace `new Monster.Constraint.Invalid()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* new Monster.Constraint.Invalid();
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/invalid.js';
* new Invalid();
* </script>
* ```
*
* @example
*
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/invalid.js';
*
* new Invalid().isValid()
* .then(()=>console.log(true))
* .catch(()=>console.log(false));
* // ↦ false
*
* @externalExample ../../example/constraints/invalid.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -58,6 +36,3 @@ class Invalid extends AbstractConstraint {
}
}
assignToNamespace('Monster.Constraints', Invalid);
export {Monster, Invalid}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray} from "../types/is.js";
import {AbstractConstraint} from "./abstract.js";
import {isArray} from "../types/is.mjs";
import {AbstractConstraint} from "./abstract.mjs";
export {IsArray}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
*
* The uniform API of the constraints allows chains to be formed.
*
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* new Monster.Constraint.IsArray()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/isarray.js';
* console.log(new IsArray())
* </script>
* ```
*
* @example
*
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/isarray.js';
*
* new IsArray()
* .isValid([])
* .then(()=>console.log(true));
* // ↦ true
*
* new IsArray()
* .isValid(99)
* .catch(e=>console.log(e));
* // ↦ 99
*
* @externalExample ../../example/constraints/isarray.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -66,6 +39,3 @@ class IsArray extends AbstractConstraint {
}
}
assignToNamespace('Monster.Constraints', IsArray);
export {Monster, IsArray}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isObject} from "../types/is.js";
import {AbstractConstraint} from "./abstract.js";
import {isObject} from "../types/is.mjs";
import {AbstractConstraint} from "./abstract.mjs";
export {IsObject}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
*
* The uniform API of the constraints allows chains to be formed.
*
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* console.log(new Monster.Constraint.IsObject())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/isobject.js';
* console.log(new IsObject())
* </script>
* ```
*
* @example
*
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/isobject.js';
*
* new IsObject()
* .isValid({})
* .then(()=>console.log(true));
* // ↦ true
*
*
* new IsObject()
* .isValid(99)
* .catch(e=>console.log(e));
* // ↦ 99
*
* @externalExample ../../example/constraints/isobject.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -67,6 +39,3 @@ class IsObject extends AbstractConstraint {
}
}
assignToNamespace('Monster.Constraints', IsObject);
export {Monster, IsObject}
'use strict';
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* Constraints are used to define conditions that must be met by the value of a variable so that the value can be transferred to the system.
*
* @namespace Constraints
* @namespace Monster.Constraints
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Constraints";
\ No newline at end of file
const ns = {};
\ No newline at end of file
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {AbstractOperator} from "./abstractoperator.js";
import {AbstractOperator} from "./abstractoperator.mjs";
export {OrOperator}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
......@@ -13,40 +16,8 @@ import {AbstractOperator} from "./abstractoperator.js";
*
* The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* new Monster.Constraint.OrOperator();
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraint/oroperator.js';
* new OrOperator();
* </script>
* ```
*
* @example
*
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/valid.js';
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/invalid.js';
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/oroperator.js';
*
* new OrOperator(
* new Valid(), new Invalid()).isValid()
* .then(()=>console.log(true))
* .catch(()=>console.log(false));
* // ↦ true
*
* new OrOperator(
* new Invalid(), new Invalid()).isValid()
* .then(()=>console.log(true))
* .catch(()=>console.log(false));
* // ↦ false
*
* @externalExample ../../example/constraints/oroperator.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -92,6 +63,3 @@ class OrOperator extends AbstractOperator {
}
assignToNamespace('Monster.Constraints', OrOperator);
export {Monster, OrOperator}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {AbstractConstraint} from "./abstract.js";
import {AbstractConstraint} from "./abstract.mjs";
export {Valid}
/**
* Constraints are used to define conditions that must be met by the value of a variable.
......@@ -13,33 +16,8 @@ import {AbstractConstraint} from "./abstract.js";
*
* The valid constraint allows an always valid query to be performed. this constraint is mainly intended for testing.
*
* You can call the method via the monster namespace `new Monster.Constraint.Valid()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* new Monster.Constraint.Valid();
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/valid.js';
* new Valid();
* </script>
* ```
*
* @example
*
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/constraints/valid.js';
*
* new Valid().isValid()
* .then(()=>console.log(true))
* .catch(()=>console.log(false));
* // ↦ true
*
* @externalExample ../../example/constraints/valid.mjs
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
......@@ -58,6 +36,3 @@ class Valid extends AbstractConstraint {
}
}
assignToNamespace('Monster.Constraints', Valid);
export {Monster, Valid}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isFunction, isObject, isString} from "../types/is.js";
import {validateString} from "../types/validate.js";
import {clone} from "../util/clone.js";
import {DELIMITER, Pathfinder, WILDCARD} from "./pathfinder.js";
import {isFunction, isObject, isString} from "../types/is.mjs";
import {validateString} from "../types/validate.mjs";
import {clone} from "../util/clone.mjs";
import {DELIMITER, Pathfinder, WILDCARD} from "./pathfinder.mjs";
export {buildMap, PARENT, assembleParts}
/**
* @type {string} parent symbol
* @type {string}
* @memberOf Monster.Data
*/
export const PARENT = '^';
const PARENT = '^';
/**
......@@ -23,98 +25,12 @@ export const PARENT = '^';
* Either a simple definition `a.b.c` or a template `${a.b.c}` can be specified as the path.
* Key and value can be either a definition or a template. The key does not have to be defined.
*
* You can call the method via the monster namespace `Monster.Data.buildMap()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* console.log(Monster.Data.buildMap())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/buildmap.js';
* console.log(buildMap())
* </script>
* ```
*
* The templates determine the appearance of the keys and the value of the map. Either a single value `id` can be taken or a composite key `${id} ${name}` can be used.
* The templates determine the appearance of the keys and the value of the map. Either a single value
* `id` can be taken or a composite key `${id} ${name}` can be used.
*
* If you want to access values of the parent data set, you have to use the `^` character `${id} ${^.name}`.
*
* @example
*
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/buildmap.js';
* // a typical data structure as reported by an api
*
* let map;
* let obj = {
* "data": [
* {
* "id": 10,
* "name": "Cassandra",
* "address": {
* "street": "493-4105 Vulputate Street",
* "city": "Saumur",
* "zip": "52628"
* }
* },
* {
* "id": 20,
* "name": "Holly",
* "address": {
* "street": "1762 Eget Rd.",
* "city": "Schwalbach",
* "zip": "952340"
* }
* },
* {
* "id": 30,
* "name": "Guy",
* "address": {
* "street": "957-388 Sollicitudin Avenue",
* "city": "Panchià",
* "zip": "420729"
* }
* }
* ]
* };
*
* // The function is passed this data structure and with the help of the selector `'data.*'` the data to be considered are selected.
* // The key is given by a simple definition `'id'` and the value is given by a template `'${name} (${address.zip} ${address.city})'`.
* map = buildMap(obj, 'data.*', '${name} (${address.zip} ${address.city})', 'id');
* console.log(map);
*
* // ↦ Map(3) {
* // '10' => 'Cassandra (52628 Saumur)',
* // '20' => 'Holly (952340 Schwalbach)',
* // '30' => 'Guy (420729 Panchià)'
* // }
*
* // If no key is specified, the key from the selection, here the array index, is taken.
* map = buildMap(obj, 'data.*', '${name} (${address.zip} ${address.city})');
* console.log(map);
*
* // ↦ Map(3) {
* // '0' => 'Cassandra (52628 Saumur)',
* // '1' => 'Holly (952340 Schwalbach)',
* // '2' => 'Guy (420729 Panchià)'
* // }
*
* // a filter (function(value, key) {}) can be specified to accept only defined entries.
* map = buildMap(obj, 'data.*', '${name} (${address.zip} ${address.city})', 'id', function (value, key) {
* return (value['id'] >= 20) ? true : false
* });
* console.log(map);
*
* // ↦ Map(2) {
* // 20 => 'Holly (952340 Schwalbach)',
* // 30 => 'Guy (420729 Panchià)'
* // }
*
* @externalExample ../../example/data/buildmap.mjs
* @param {*} subject
* @param {string|Monster.Data~exampleSelectorCallback} selector
* @param {string} [valueTemplate]
......@@ -134,6 +50,7 @@ function buildMap(subject, selector, valueTemplate, keyTemplate, filter) {
}
/**
* @private
* @param {*} subject
......@@ -261,7 +178,7 @@ function buildFlatMap(subject, selector, key, parentMap) {
* Alternatively to a string selector a callback can be specified. this must return a map.
*
* @example
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/buildmap.js';
* import {buildMap} from '@schukai/monster/source/data/buildmap.mjs';
*
* let obj = {
* "data": [
......@@ -384,6 +301,7 @@ function buildFlatMap(subject, selector, key, parentMap) {
* @callback Monster.Data~exampleSelectorCallback
* @param {*} subject subject
* @return Map
* @license AGPLv3
* @since 1.17.0
* @memberOf Monster.Data
* @see {@link Monster.Data.buildMap}
......@@ -427,7 +345,3 @@ function build(subject, definition, defaultValue) {
return definition;
}
assignToNamespace('Monster.Data', buildMap);
export {Monster, buildMap, assembleParts}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray, isObject} from "../types/is.js";
import {Node} from "../types/node.js";
import {NodeList} from "../types/nodelist.js";
import {assembleParts} from "./buildmap.js";
import {extend} from "./extend.js";
import {isArray, isObject} from "../types/is.mjs";
import {Node} from "../types/node.mjs";
import {NodeList} from "../types/nodelist.mjs";
import {assembleParts} from "./buildmap.mjs";
import {extend} from "./extend.mjs";
export {buildTree}
/**
* @private
......@@ -34,24 +35,6 @@ const rootSymbol = Symbol('root');
/**
* With the help of the function `buildTree()`, nodes can be easily created from data objects.
*
* You can call the method via the monster namespace `Monster.Data.buildTree()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/buildtree.js';
* Monster.Data.buildTree()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {buildTree} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/buildtree.js';
* buildTree()
* </script>
* ```
*
* @param {*} subject
* @param {string|Monster.Data~exampleSelectorCallback} selector
* @param {string} idKey
......@@ -62,6 +45,7 @@ const rootSymbol = Symbol('root');
* @throws {TypeError} value is neither a string nor a function
* @throws {TypeError} the selector callback must return a map
* @throws {Error} the object has no value for the specified id
* @license AGPLv3
* @since 1.26.0
*/
function buildTree(subject, selector, idKey, parentIDKey, options) {
......@@ -123,7 +107,3 @@ function buildTree(subject, selector, idKey, parentIDKey, options) {
return list;
}
assignToNamespace('Monster.Data', buildTree);
export {Monster, buildTree}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../constants.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from "../types/base.js";
import {parseDataURL} from "../types/dataurl.js";
import {isString} from "../types/is.js";
import {ProxyObserver} from "../types/proxyobserver.js";
import {validateObject} from "../types/validate.js";
import {extend} from "./extend.js";
import {Pathfinder} from "./pathfinder.js";
import {internalSymbol} from "../constants.mjs";
import {Base} from "../types/base.mjs";
import {parseDataURL} from "../types/dataurl.mjs";
import {isString} from "../types/is.mjs";
import {ProxyObserver} from "../types/proxyobserver.mjs";
import {validateObject} from "../types/validate.mjs";
import {extend} from "./extend.mjs";
import {Pathfinder} from "./pathfinder.mjs";
export {Datasource}
/**
* @private
* @type {symbol}
* @memberOf Monster.Data
* @license AGPLv3
* @since 1.24.0
*/
const internalDataSymbol = Symbol('internalData');
......@@ -26,35 +29,8 @@ const internalDataSymbol = Symbol('internalData');
/**
* The datasource class is the basis for dealing with different data sources.
* It provides a unified interface for accessing data
*
* You can create an object of this class using the monster namespace `Monster.Data.Datasource()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* Monster.Data.Datasource()
* </script>
* ```
*
* Alternatively you can import the class directly
*
* ```
* <script type="module">
* import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource.js';
* new Datasource()
* </script>
* ```
*
* @example
*
* import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource.js'
*
* class MyDatasource extends Datasource {
*
* }
*
* const ds = new MyDatasource();
*
* @externalExample ../../example/data/datasource.mjs
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -240,7 +216,3 @@ function parseOptionsJSON(data) {
return {};
}
assignToNamespace('Monster.Data', Datasource);
export {Monster, Datasource}
'use strict';
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* Namespace for datasources
......@@ -7,10 +10,4 @@
* @memberOf Monster.Data
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Data.Datasource";
\ No newline at end of file
const ns = {};
\ No newline at end of file
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../../constants.js";
import {assignToNamespace, Monster} from '../../namespace.js';
import {isObject} from "../../types/is.js";
import {Datasource} from "../datasource.js";
import {Pathfinder} from "../pathfinder.js";
import {Pipe} from "../pipe.js";
import {WriteError} from "./restapi/writeerror.js";
import {internalSymbol} from "../../constants.mjs";
import {isObject} from "../../types/is.mjs";
import {Datasource} from "../datasource.mjs";
import {Pathfinder} from "../pathfinder.mjs";
import {Pipe} from "../pipe.mjs";
import {WriteError} from "./restapi/writeerror.mjs";
export {RestAPI}
/**
* You can create an object of this class using the monster namespace `Monster.Data.Datasource.RestAPI()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* Monster.Data.Datasource.RestAPI()
* </script>
* ```
*
* Alternatively you can import the class directly
*
* ```
* <script type="module">
* import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource/restapi.js';
* new RestAPI()
* </script>
* ```
*
* @example
*
* import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource/restapi.js';
*
* const ds = new RestAPI({
* url: 'https://httpbin.org/get'
* },{
* url: 'https://httpbin.org/post'
* });
*
* ds.set({flag:true})
* ds.write().then(()=>console.log('done'));
* ds.read().then(()=>console.log('done'));
* The RestAPI is a class that enables a REST API server.
*
* @externalExample ../../../example/data/storage/restapi.mjs
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource
......@@ -260,7 +234,3 @@ class RestAPI extends Datasource {
* @memberOf Monster.Data
* @see Monster.Data.Datasource
*/
assignToNamespace('Monster.Data.Datasource', RestAPI);
export {Monster, RestAPI}