qcobjects 2.4.15-beta → 2.4.20-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
+
4
+ name: Node.js Publish Beta version
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - 'v*.*-lts'
10
+ tags:
11
+ - 'v*.*.*-lts'
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/setup-node@v1
19
+ with:
20
+ node-version: 14
21
+ - run: npm ci
22
+ - run: npm test
23
+
24
+ publish-npm:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: actions/setup-node@v1
30
+ with:
31
+ node-version: 12
32
+ registry-url: https://registry.npmjs.org/
33
+ - name: Set up NPM authentication
34
+ run: echo "registry=https://registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
35
+ - run: npm ci
36
+ - run: npm publish --tag ${GITHUB_REF##*/}
37
+ env:
38
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@@ -28,7 +28,7 @@ jobs:
28
28
  - uses: actions/checkout@v2
29
29
  - uses: actions/setup-node@v1
30
30
  with:
31
- node-version: 12
31
+ node-version: 14
32
32
  registry-url: https://registry.npmjs.org/
33
33
  - name: Set up NPM authentication
34
34
  run: echo "registry=https://registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
package/QCObjects.js CHANGED
@@ -309,8 +309,14 @@
309
309
  }
310
310
  },
311
311
  info (message) {
312
+ var color;
312
313
  if (this.infoEnabled) {
313
- console.info("\x1b[33m%s\x1b[0m","[INFO] " + message);
314
+ if (isBrowser) {
315
+ color = "\x1b[103m%s\x1b[0m";
316
+ } else {
317
+ color = "\x1b[33m%s\x1b[0m";
318
+ }
319
+ console.info(color,"[INFO] " + message);
314
320
  }
315
321
  },
316
322
  warn (message) {
@@ -2121,27 +2127,51 @@
2121
2127
  route () {
2122
2128
  var componentClass = this;
2123
2129
  var isValidInstance = ((!!componentClass.__instanceID) &&
2124
- componentClass.hasOwnProperty.call(componentClass,"subcomponents")) ? (true) : (false);
2130
+ Object.hasOwnProperty.call(componentClass,"subcomponents")) ? (true) : (false);
2125
2131
  var __route__ = function(componentList) {
2126
- componentList.map(function (rc, r){
2127
- if (typeof rc !== "undefined"
2128
- && rc.hasOwnProperty.call(rc,"_reroute_")){
2129
- rc._reroute_();
2130
- if (rc.hasOwnProperty.call(rc,"subcomponents") &&
2131
- typeof rc.subcomponents !== "undefined" &&
2132
- rc.subcomponents.length > 0
2133
- ) {
2134
- logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + rc.name);
2135
- __route__.call(componentClass, rc.subcomponents);
2136
- }
2137
- } else if (typeof rc !== "undefined"){
2138
- logger.debug("IT WAS NOT POSSIBLE TO RE-ROUTE: " + rc.name);
2132
+ var _componentNames_ = [];
2133
+ var _promises_ = componentList.filter(function (rc){return typeof rc !== "undefined";}).map(function (rc){
2134
+ if (typeof rc.name !== "undefined"){
2135
+ _componentNames_.push(rc.name);
2136
+ } else {
2137
+ throw new Error(__getType__(rc)+" does not have a name");
2139
2138
  }
2139
+ return new Promise (function (resolve, reject){
2140
+ var _promise_;
2141
+ if (typeof rc !== "undefined"
2142
+ && Object.hasOwnProperty.call(rc,"_reroute_")){
2143
+ _promise_ = rc._reroute_()
2144
+ .then(function (){
2145
+ rc.body.innerHTML = "";
2146
+ rc.innerHTML = "";
2147
+ return rc.rebuild();})
2148
+ .then (function (_rc_){
2149
+ if (Object.hasOwnProperty.call(_rc_,"subcomponents") &&
2150
+ typeof _rc_.subcomponents !== "undefined" &&
2151
+ _rc_.subcomponents.length > 0
2152
+ ) {
2153
+ logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + _rc_.name);
2154
+ return __route__.call(_rc_, _rc_.subcomponents);
2155
+ } else {
2156
+ resolve(_rc_);
2157
+ }
2158
+ });
2159
+ } else if (typeof rc !== "undefined"){
2160
+ reject("Component " + rc.name + " is not an instance of Component");
2161
+ }
2162
+ return _promise_;
2163
+ });
2140
2164
  });
2165
+ return Promise.all(_promises_)
2166
+ .then(function (){
2167
+ logger.debug("ROUTING COMPLETED FOR "+ _componentNames_.join(", "));
2168
+ }).catch(function (err){
2169
+ logger.error("ROUTING FAILED FOR "+ _componentNames_.join(", ") + ": " + err);
2170
+ });
2141
2171
  };
2142
- if (isValidInstance || global.hasOwnProperty.call(_top.global,"componentsStack")) {
2143
- if (isValidInstance && componentClass.hasOwnProperty.call(componentClass,"name")) {
2144
- logger.debug("loading routings for instance" + componentClass.name);
2172
+ if (isValidInstance || Object.hasOwnProperty.call(global,"componentsStack")) {
2173
+ if (isValidInstance && is_a(componentClass, "Component")){
2174
+ logger.debug("loading routings for instance " + componentClass.name);
2145
2175
  }
2146
2176
  __route__.call(componentClass, (isValidInstance) ? (componentClass.subcomponents) : (global.componentsStack));
2147
2177
  } else {
@@ -2239,7 +2269,7 @@
2239
2269
  var self = this;
2240
2270
 
2241
2271
  if (typeof self.name === "undefined"){
2242
- logger.debug("Component name is not defined");
2272
+ logger.warn("A name is not defined for "+__getType__(self));
2243
2273
  }
2244
2274
 
2245
2275
  self.routingWay = _top.CONFIG.get("routingWay");
@@ -3009,6 +3039,10 @@
3009
3039
  var _serviceLoaderInNode = function(service, _async) {
3010
3040
  var _promise = new Promise(
3011
3041
  function(resolve, reject) {
3042
+ if (typeof URL === "undefined") {
3043
+ global.URL = require("url").URL;
3044
+ let URL = global.URL;
3045
+ }
3012
3046
  var serviceURL = new URL(service.url);
3013
3047
  var req;
3014
3048
  service.useHTTP2 = Object.hasOwnProperty.call(service,"useHTTP2") && service.useHTTP2;
@@ -3264,7 +3298,7 @@
3264
3298
  }
3265
3299
  };
3266
3300
  logger.debug("Starting to load the config settings...");
3267
- if (ClassFactory("CONFIG").get("useConfigService", false)) {
3301
+ if (_top.CONFIG.get("useConfigService", false)) {
3268
3302
  logger.debug("Loading settings using local configuration file...");
3269
3303
  _top.global.configService = New(ClassFactory("ConfigService"));
3270
3304
  _top.global.configService.configLoaded = _buildComponents;
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ![logo](https://qcobjects.dev/qcobjects_01.png)
2
2
 
3
3
  [![GitHub license](https://img.shields.io/github/license/QuickCorp/QCObjects.svg)](https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FQuickCorp%2FQCObjects.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FQuickCorp%2FQCObjects?ref=badge_shield) [![](https://data.jsdelivr.com/v1/package/npm/qcobjects/badge)](https://www.jsdelivr.com/package/npm/qcobjects) [![Badge for version for Visual Studio Code extension Quickcorp.QCObjects-vscode](https://vsmarketplacebadge.apphb.com/version/Quickcorp.QCObjects-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=Quickcorp.QCObjects-vscode) [![Documentation Status](https://readthedocs.org/projects/qcobjects/badge/?version=latest)](https://qcobjects.readthedocs.io/?badge=latest) [![GitHub release](https://img.shields.io/github/issues/QuickCorp/QCObjects.svg)](https://github.com/QuickCorp/QCObjects/releases/) [![GitHub stars](https://img.shields.io/github/stars/QuickCorp/QCObjects.svg)](https://github.com/QuickCorp/QCObjects) [![npm version](https://badge.fury.io/js/qcobjects.svg)](https://badge.fury.io/js/qcobjects) ![apm: version](https://flat.badgen.net/apm/v/qcobjects-syntax?params) ![docker pulls](https://img.shields.io/docker/pulls/quickcorp/qcobjects.svg) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
+ [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5295/badge)](https://bestpractices.coreinfrastructure.org/projects/5295)
5
+
4
6
 
5
7
  [![Become a Patreon ](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/join/qcobjects?)
6
8
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.15-beta
1
+ 2.4.20-beta
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qcobjects",
3
- "version": "2.4.15-beta",
3
+ "version": "2.4.20-beta",
4
4
  "description": "QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.",
5
5
  "main": "QCObjects.js",
6
6
  "license": "LGPL-3.0",