qcobjects 2.5.115-beta → 2.5.118-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.
@@ -1,32 +1,24 @@
1
1
  declare module "is_raw_class" {
2
2
  export const __is_raw_class__: (o_c: any) => boolean;
3
3
  }
4
- declare module "PrimaryCollections" {
5
- import { T_QC_CLASSES, T_QC_PACKAGES } from "types";
6
- export var _QC_CLASSES: T_QC_CLASSES;
7
- export var _QC_PACKAGES: T_QC_PACKAGES;
8
- export var _QC_PACKAGES_IMPORTED: any[];
9
- export var _QC_READY_LISTENERS: any[];
10
- }
11
- declare module "ClassFactory" {
12
- import { TClassFactory } from "types";
13
- export const ClassFactory: TClassFactory;
14
- }
15
- declare module "Cast" {
4
+ declare module "ObjectName" {
16
5
  /**
17
- * Casts an object to another object class type
6
+ * Returns the object or function name
18
7
  *
19
- * @param {Object} obj_source
20
- * @param {Object} obj_dest
8
+ * @param Object or function
21
9
  */
22
- export const _Cast: (obj_source: any, obj_dest: any) => any;
10
+ export const ObjectName: (o: any) => string;
11
+ }
12
+ declare module "getType" {
23
13
  /**
24
- * Casts an object to another object class type. Only properties
14
+ * Determine the type of the Object for any QCObjects Object
25
15
  *
26
- * @param {Object} obj_source
27
- * @param {Object} obj_dest
16
+ * @param {Object} object
28
17
  */
29
- export const _CastProps: (obj_source: any, obj_dest: any, _ignoreError?: boolean) => any;
18
+ export const __getType__: (o_c: any) => any;
19
+ }
20
+ declare module "Export" {
21
+ export const Export: (f: any) => void;
30
22
  }
31
23
  declare module "_import_" {
32
24
  function _import_(name: string): Promise<any>;
@@ -40,26 +32,37 @@ declare module "platform" {
40
32
  export const _require_: (name: string) => any;
41
33
  export const is_phonegap: boolean;
42
34
  }
43
- declare module "DOMCreateElement" {
44
- import { IQCObjectsElement } from "types";
45
- export const _DOMCreateElement: (elementName: string, props?: any[], children?: any) => IQCObjectsElement;
46
- export const _DOMCreateComplexElement: (_type: string | Function, props?: any[], children?: any) => HTMLElement;
35
+ declare module "Logger" {
36
+ export class Logger {
37
+ debugEnabled: boolean;
38
+ infoEnabled: boolean;
39
+ warnEnabled: boolean;
40
+ debug(message: string): void;
41
+ info(message: string): void;
42
+ warn(message: string): void;
43
+ }
44
+ export const logger: Logger;
47
45
  }
48
- declare module "ObjectName" {
46
+ declare module "Cast" {
49
47
  /**
50
- * Returns the object or function name
48
+ * Casts an object to another object class type
51
49
  *
52
- * @param Object or function
50
+ * @param {Object} obj_source
51
+ * @param {Object} obj_dest
53
52
  */
54
- export const ObjectName: (o: any) => string;
55
- }
56
- declare module "getType" {
53
+ export const _Cast: (obj_source: any, obj_dest: any) => any;
57
54
  /**
58
- * Determine the type of the Object for any QCObjects Object
55
+ * Casts an object to another object class type. Only properties
59
56
  *
60
- * @param {Object} object
57
+ * @param {Object} obj_source
58
+ * @param {Object} obj_dest
61
59
  */
62
- export const __getType__: (o_c: any) => any;
60
+ export const _CastProps: (obj_source: any, obj_dest: any, _ignoreError?: boolean) => any;
61
+ }
62
+ declare module "DOMCreateElement" {
63
+ import { IQCObjectsElement } from "types";
64
+ export const _DOMCreateElement: (elementName: string, props?: any[], children?: any) => IQCObjectsElement;
65
+ export const _DOMCreateComplexElement: (_type: string | Function, props?: any[], children?: any) => HTMLElement;
63
66
  }
64
67
  declare module "IncrementInstanceID" {
65
68
  /**
@@ -72,10 +75,6 @@ declare module "introspection" {
72
75
  export const _protected_code_: (_: any) => void;
73
76
  export const _methods_: <T>(_: any) => T[];
74
77
  }
75
- declare module "RegisterClass" {
76
- export const __register_class__: (_class_: any, __namespace?: string) => any;
77
- export const RegisterClass: (_class_: any, __namespace?: string) => any;
78
- }
79
78
  declare module "Package" {
80
79
  /**
81
80
  * Defines a package for Class classification
@@ -83,7 +82,7 @@ declare module "Package" {
83
82
  * @param {Object} namespace
84
83
  * @param {Object} classes
85
84
  */
86
- export const Package: (namespace: string, classes?: any[]) => any[] | undefined;
85
+ export const Package: (namespace: string, classes?: any[]) => any[];
87
86
  }
88
87
  declare module "InheritClass" {
89
88
  import { type IInheritClass, type TBody } from "types";
@@ -635,19 +634,23 @@ declare module "top" {
635
634
  declare module "make_global" {
636
635
  export const __make_global__: (f: any) => void;
637
636
  }
638
- declare module "Export" {
639
- export const Export: (f: any) => void;
637
+ declare module "PrimaryCollections" {
638
+ import { T_QC_CLASSES, T_QC_PACKAGES } from "types";
639
+ export var _QC_CLASSES: T_QC_CLASSES;
640
+ export var _QC_PACKAGES: T_QC_PACKAGES;
641
+ export var _QC_PACKAGES_IMPORTED: any[];
642
+ export var _QC_READY_LISTENERS: any[];
643
+ export const __register_class__: (_class_: any, __namespace?: string) => any;
644
+ export const get_QC_CLASS: (name: string) => any;
645
+ export const getPackagesNamesList: () => any[];
646
+ export const getPackagesList: () => any[];
647
+ export const getClassesList: () => any[];
648
+ export const getClassesNamesList: () => any[];
649
+ export const set_QC_PACKAGE: (packageName: string, _qc_packages: any[]) => void;
640
650
  }
641
- declare module "Logger" {
642
- export class Logger {
643
- debugEnabled: boolean;
644
- infoEnabled: boolean;
645
- warnEnabled: boolean;
646
- debug(message: string): void;
647
- info(message: string): void;
648
- warn(message: string): void;
649
- }
650
- export const logger: Logger;
651
+ declare module "ClassFactory" {
652
+ import { TClassFactory } from "types";
653
+ export const ClassFactory: TClassFactory;
651
654
  }
652
655
  declare module "mathFunctions" {
653
656
  export const __to_number: (value: any) => number;
@@ -746,6 +749,9 @@ declare module "DDO" {
746
749
  _new_({ instance, name, fget, fset }: TDDOParams): void;
747
750
  }
748
751
  }
752
+ declare module "RegisterClass" {
753
+ export const RegisterClass: (_class_: any, __namespace?: string) => any;
754
+ }
749
755
  declare module "DefaultTemplateHandler" {
750
756
  import { DefaultTemplateHandlerParams } from "types";
751
757
  export class DefaultTemplateHandler {
@@ -763,12 +769,13 @@ declare module "DocumentLayout" {
763
769
  declare module "Effect" {
764
770
  import { IEffect, TEffectParams } from "types";
765
771
  import { InheritClass } from "InheritClass";
766
- export class Effect extends InheritClass implements IEffect {
772
+ class Effect extends InheritClass implements IEffect {
767
773
  done(...args: any[]): any;
768
774
  apply(...args: any[]): void;
769
775
  duration: number;
770
776
  animate({ timing, draw, duration }: TEffectParams): void;
771
777
  }
778
+ export { Effect };
772
779
  }
773
780
  declare module "findPackageNodePath" {
774
781
  export const findPackageNodePath: (packagename: string) => string | null;
@@ -978,6 +985,7 @@ declare module "Toggle" {
978
985
  declare module "QCObjects" {
979
986
  export * as AssignPolyfill from "assign";
980
987
  export * as __top__ from "top";
988
+ export * as QCObjects from "MainProcess";
981
989
  export { _top, resetTop } from "top";
982
990
  export { _QC_CLASSES, _QC_PACKAGES, _QC_PACKAGES_IMPORTED, _QC_READY_LISTENERS } from "PrimaryCollections";
983
991
  export { _DataStringify } from "DataStringify";
@@ -1044,7 +1052,6 @@ declare module "QCObjects" {
1044
1052
  export { _top as global } from "top";
1045
1053
  export { __make_global__ } from "make_global";
1046
1054
  export { get, set } from "top";
1047
- export * as QCObjects from "MainProcess";
1048
1055
  }
1049
1056
  declare module "index" {
1050
1057
  import * as QCObjects from "QCObjects";
@@ -5,6 +5,12 @@ import { __getType__, logger, global } from "../src/QCObjects";
5
5
  /* eslint-disable no-undef */
6
6
 
7
7
  describe("qcobjects", function () {
8
+ it("Existence of global.PackagesList Spec", function () {
9
+ let packagesList:any[] = global.PackagesList;
10
+ expect(__getType__(packagesList)).toBe("Array");
11
+
12
+ logger.debug("Existence of global.PackagesList Spec... OK");
13
+ });
8
14
 
9
15
  it("Existence of global.ClassesList Spec", function () {
10
16
  logger.debugEnabled=true;
@@ -23,12 +29,6 @@ describe("qcobjects", function () {
23
29
  logger.debug("Existence of global.PackagesNameList Spec... OK");
24
30
  });
25
31
 
26
- it("Existence of global.PackagesList Spec", function () {
27
- let packagesList:any[] = global.PackagesList;
28
- expect(__getType__(packagesList)).toBe("Array");
29
-
30
- logger.debug("Existence of global.PackagesList Spec... OK");
31
- });
32
32
 
33
33
  it("Existence of global.ClassesNameList Spec", function () {
34
34
  let classesNameList = global.ClassesNameList;
package/spec/testsSpec.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { _DataStringify, Class, ClassFactory, Component, CONFIG, Effect, logger, New, global, InheritClass, __getType__ } from "../src/QCObjects";
3
+ import { _DataStringify, Class, ClassFactory, Component, CONFIG, Effect, logger, New, global, InheritClass, __getType__, _QC_CLASSES } from "../src/QCObjects";
4
4
 
5
5
 
6
6
  /* eslint-disable no-undef */
@@ -30,7 +30,7 @@ describe("qcobjects", function () {
30
30
  });
31
31
 
32
32
  it("Existence of Component Class", function () {
33
- expect(Component as unknown as InheritClass).toEqual(ClassFactory("Component"));
33
+ expect(Component).toEqual(ClassFactory("Component"));
34
34
  logger.debug("Existence of Component Class... OK");
35
35
  });
36
36
 
package/src/Class.ts CHANGED
@@ -287,9 +287,6 @@ export const Class: TClass = (name?: string, _type?: unknown, _definition?: unkn
287
287
  _QC_CLASSES[name] = _CastProps(definition, _QC_CLASSES[name]);
288
288
  _QC_CLASSES[name].__definition = definition;
289
289
  _QC_CLASSES[name].__definition.__classType = name;
290
- _QC_CLASSES[name].__definition.__new__ = function __new__(_o_: any) {
291
- _CastProps(_o_, this);
292
- };
293
290
 
294
291
  (_top as any)[name] = _QC_CLASSES[name];
295
292
 
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { __is_raw_class__ } from "./is_raw_class";
8
- import { _QC_CLASSES, _QC_PACKAGES } from "./PrimaryCollections";
8
+ import { _QC_CLASSES, _QC_PACKAGES, get_QC_CLASS } from "./PrimaryCollections";
9
9
  import { TClassFactory } from "types";
10
10
 
11
11
  export const ClassFactory:TClassFactory = (className:string):any => {
@@ -13,7 +13,7 @@ export const ClassFactory:TClassFactory = (className:string):any => {
13
13
  if (typeof className === "undefined" || className === null) {
14
14
  throw Error ("You need to pass a parameter {className}");
15
15
  }
16
- if (className !== null && className.indexOf(".") > -1) {
16
+ if (className !== null && className.indexOf(".") !== -1) {
17
17
  const packageName = className.split(".").slice(0, className.split(".").length - 1).join(".");
18
18
  const _className = className.split(".").slice(-1).join("");
19
19
  const _package = _QC_PACKAGES[packageName] || [];
@@ -25,10 +25,13 @@ export const ClassFactory:TClassFactory = (className:string):any => {
25
25
  } else {
26
26
  throw Error(`Class ${_className} not found. Found classes: ${JSON.stringify(packageClasses)} in package ${packageName}`);
27
27
  }
28
- } else if (className !== null && Object.hasOwn(_QC_CLASSES, className)) {
29
- _classFactory = _QC_CLASSES[className];
28
+ } else if (className !== null) {
29
+ _classFactory = get_QC_CLASS(className);
30
+ if (typeof _classFactory === "undefined"){
31
+ throw new Error (`${className} is undefined.`);
32
+ }
30
33
  } else {
31
- throw Error(`Unable to determine class ${className}. Unable to retrieve the class factory.`);
34
+ throw Error(`className is null. Unable to retrieve the class factory.\n Not found in: \n ${Object.keys(_QC_CLASSES).join("\n")}`);
32
35
  }
33
36
  return _classFactory;
34
37
  };
package/src/Effect.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { IEffect, TEffectParams } from "types";
2
2
  import { InheritClass } from "./InheritClass";
3
3
  import { Package } from "./Package";
4
+ import { _methods_, _protected_code_ } from "./introspection";
5
+ import { ClassFactory } from "./ClassFactory";
4
6
 
5
- export class Effect extends InheritClass implements IEffect{
7
+ class Effect extends InheritClass implements IEffect{
6
8
  // eslint-disable-next-line no-unused-vars
7
9
  done (...args: any[]): any {
8
10
  throw new Error("Method not implemented.");
@@ -54,3 +56,10 @@ export class Effect extends InheritClass implements IEffect{
54
56
  Package("com.qcobjects.effects.base", [
55
57
  Effect
56
58
  ]);
59
+
60
+ (_methods_)(ClassFactory("Effect")).map( (__c__):any => {
61
+ (_protected_code_)(__c__);
62
+ return __c__;
63
+ });
64
+
65
+ export {Effect};