qcobjects 2.5.104-beta → 2.5.105-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.
@@ -3454,17 +3454,262 @@ var init_ComponentFactory = __esm({
3454
3454
  }
3455
3455
  });
3456
3456
 
3457
+ // src/Service.ts
3458
+ var Service, JSONService, ConfigService;
3459
+ var init_Service = __esm({
3460
+ "src/Service.ts"() {
3461
+ "use strict";
3462
+ init_basePath();
3463
+ init_Crypt();
3464
+ init_domain();
3465
+ init_InheritClass();
3466
+ init_Logger();
3467
+ init_Package();
3468
+ init_secretKey();
3469
+ init_CONFIG();
3470
+ Service = class extends InheritClass {
3471
+ static {
3472
+ __name(this, "Service");
3473
+ }
3474
+ options;
3475
+ withCredentials;
3476
+ useHTTP2;
3477
+ // eslint-disable-next-line no-unused-vars
3478
+ mockup({ request, service }) {
3479
+ throw new Error("Method not implemented.");
3480
+ }
3481
+ name;
3482
+ responseHeaders;
3483
+ // eslint-disable-next-line no-unused-vars
3484
+ local({ request, service }) {
3485
+ throw new Error("Method not implemented.");
3486
+ }
3487
+ kind = "rest";
3488
+ /* it can be rest, mockup, local */
3489
+ domain = _domain_;
3490
+ basePath = _basePath_;
3491
+ url = "";
3492
+ method = "GET";
3493
+ data = {};
3494
+ reload = false;
3495
+ cached = false;
3496
+ headers;
3497
+ template;
3498
+ // eslint-disable-next-line no-unused-vars
3499
+ done({ request, service }) {
3500
+ throw new Error("Method not implemented.");
3501
+ }
3502
+ // eslint-disable-next-line no-unused-vars
3503
+ fail(...args) {
3504
+ throw new Error("Method not implemented.");
3505
+ }
3506
+ set(name, value) {
3507
+ this[name] = value;
3508
+ }
3509
+ get(name, _default) {
3510
+ return this[name] || _default;
3511
+ }
3512
+ };
3513
+ JSONService = class extends Service {
3514
+ static {
3515
+ __name(this, "JSONService");
3516
+ }
3517
+ method = "GET";
3518
+ cached = false;
3519
+ headers = {
3520
+ "Content-Type": "application/json",
3521
+ "charset": "utf-8"
3522
+ };
3523
+ JSONresponse = void 0;
3524
+ done(result) {
3525
+ logger.debug("***** RECEIVED RESPONSE:");
3526
+ logger.debug(result.service.template);
3527
+ this.JSONresponse = JSON.parse(result.service.template);
3528
+ }
3529
+ };
3530
+ ConfigService = class extends JSONService {
3531
+ static {
3532
+ __name(this, "ConfigService");
3533
+ }
3534
+ method = "GET";
3535
+ cached = false;
3536
+ configFileName = "config.json";
3537
+ headers = {
3538
+ "Content-Type": "application/json",
3539
+ "charset": "utf-8"
3540
+ };
3541
+ configLoaded() {
3542
+ throw Error("Method not implemented.");
3543
+ }
3544
+ JSONresponse = void 0;
3545
+ done(result) {
3546
+ logger.debug("***** CONFIG LOADED:");
3547
+ logger.debug(result.service.template);
3548
+ this.JSONresponse = JSON.parse(result.service.template);
3549
+ if (Object.hasOwn(this.JSONresponse, "__encoded__")) {
3550
+ const decodedValue = _Crypt.decrypt(this.JSONresponse?.__encoded__, _secretKey);
3551
+ this.JSONresponse = JSON.parse(decodedValue);
3552
+ }
3553
+ const jsonResponse = this.JSONresponse;
3554
+ Object.keys(jsonResponse).map((k) => {
3555
+ CONFIG.set(k, jsonResponse[k]);
3556
+ return k;
3557
+ });
3558
+ this.configLoaded().catch((e) => {
3559
+ throw new Error(`An error ocurred: ${e}`);
3560
+ });
3561
+ }
3562
+ fail() {
3563
+ this.configLoaded().catch((e) => {
3564
+ throw new Error(`An error ocurred: ${e}`);
3565
+ });
3566
+ }
3567
+ constructor() {
3568
+ super();
3569
+ this.set("url", `${this.get("basePath")}${this.get("configFileName")}`);
3570
+ }
3571
+ };
3572
+ Package("com.qcobjects.api", [
3573
+ Service
3574
+ ]);
3575
+ Package("com.qcobjects.api.services", [
3576
+ JSONService
3577
+ ]);
3578
+ Package("com.qcobjects.api.config", [
3579
+ ConfigService
3580
+ ]);
3581
+ }
3582
+ });
3583
+
3584
+ // src/globalSettings.ts
3585
+ var GlobalSettings;
3586
+ var init_globalSettings = __esm({
3587
+ "src/globalSettings.ts"() {
3588
+ "use strict";
3589
+ init_CONFIG();
3590
+ init_InheritClass();
3591
+ init_Logger();
3592
+ init_Package();
3593
+ init_platform();
3594
+ init_serviceLoader();
3595
+ init_top();
3596
+ init_Service();
3597
+ GlobalSettings = class _GlobalSettings extends InheritClass {
3598
+ static {
3599
+ __name(this, "GlobalSettings");
3600
+ }
3601
+ static __start__() {
3602
+ return _GlobalSettings.instance.__start__();
3603
+ }
3604
+ _GLOBAL = {};
3605
+ static _instance;
3606
+ static get instance() {
3607
+ if (typeof _GlobalSettings._instance === "undefined") {
3608
+ _GlobalSettings._instance = new _GlobalSettings();
3609
+ }
3610
+ return _GlobalSettings._instance;
3611
+ }
3612
+ set(name, value) {
3613
+ this._GLOBAL[name] = value;
3614
+ }
3615
+ get(name, _default) {
3616
+ let _value;
3617
+ if (typeof this._GLOBAL[name] !== "undefined") {
3618
+ _value = this._GLOBAL[name];
3619
+ } else if (typeof _default !== "undefined") {
3620
+ _value = _default;
3621
+ }
3622
+ return _value;
3623
+ }
3624
+ __start__() {
3625
+ const __load__serviceWorker = /* @__PURE__ */ __name(function() {
3626
+ let _promise;
3627
+ if (isBrowser) {
3628
+ _promise = new Promise(function(resolve, reject) {
3629
+ if ("serviceWorker" in navigator && typeof CONFIG.get("serviceWorkerURI") !== "undefined") {
3630
+ CONFIG.set("serviceWorkerScope", CONFIG.get("serviceWorkerScope") ? CONFIG.get("serviceWorkerScope") : "/");
3631
+ navigator.serviceWorker.register(CONFIG.get("serviceWorkerURI"), {
3632
+ scope: CONFIG.get("serviceWorkerScope")
3633
+ }).then(function(registration) {
3634
+ logger.debug("Service Worker Registered");
3635
+ resolve.call(_promise, registration);
3636
+ }, function(registration) {
3637
+ logger.debug("Error registering Service Worker");
3638
+ reject.call(_promise, registration);
3639
+ });
3640
+ navigator.serviceWorker.ready.then(function(registration) {
3641
+ logger.debug("Service Worker Ready");
3642
+ resolve.call(_promise, registration);
3643
+ }, function(registration) {
3644
+ logger.debug("Error loading Service Worker");
3645
+ reject.call(_promise, registration);
3646
+ });
3647
+ }
3648
+ });
3649
+ } else {
3650
+ _promise = Promise.resolve();
3651
+ }
3652
+ return _promise;
3653
+ }, "__load__serviceWorker");
3654
+ const _buildComponents = /* @__PURE__ */ __name(function() {
3655
+ return new Promise((resolve) => {
3656
+ if (isBrowser) {
3657
+ logger.debug("Starting to building components");
3658
+ try {
3659
+ buildComponentsStack();
3660
+ } catch (e) {
3661
+ throw Error(`Something went wrong trying to start components tree: ${e.message}`);
3662
+ }
3663
+ logger.debug("Initializing the service worker");
3664
+ __load__serviceWorker.call(_top).catch(function(e) {
3665
+ logger.debug(`error loading the service worker ${e}`);
3666
+ });
3667
+ }
3668
+ resolve();
3669
+ });
3670
+ }, "_buildComponents");
3671
+ return new Promise((resolve) => {
3672
+ logger.debug("Starting to load the config settings...");
3673
+ if (CONFIG.get("useConfigService", false)) {
3674
+ logger.debug("Loading settings using local configuration file...");
3675
+ setConfigService(new ConfigService());
3676
+ configService.configLoaded = _buildComponents;
3677
+ serviceLoader(configService)?.then((standardResponse) => {
3678
+ resolve(standardResponse);
3679
+ })?.catch((e) => {
3680
+ throw new Error(`An error ocurred while trying to load ${configService.url}: ${e}`);
3681
+ });
3682
+ } else {
3683
+ logger.debug("Starting to load the components...");
3684
+ _buildComponents.call(this).then(() => {
3685
+ resolve({});
3686
+ }).catch((e) => {
3687
+ throw new Error(`An error ocurred while trying to build the components stack. ${e}`);
3688
+ });
3689
+ }
3690
+ });
3691
+ }
3692
+ };
3693
+ Package("com.qcobjects", [
3694
+ GlobalSettings
3695
+ ]);
3696
+ }
3697
+ });
3698
+
3457
3699
  // src/top.ts
3458
- var _top, componentsStack, resetTop, buildComponentsStack, configService, setConfigService;
3700
+ var _top, componentsStack, resetTop, buildComponentsStack, configService, setConfigService, set, get;
3459
3701
  var init_top = __esm({
3460
3702
  "src/top.ts"() {
3461
3703
  "use strict";
3462
3704
  init_ComponentFactory();
3463
- _top = typeof self !== "undefined" && self || typeof window !== "undefined" && window || typeof global !== "undefined" && global || void 0;
3705
+ init_Cast();
3706
+ init_globalSettings();
3707
+ _top = typeof module !== "undefined" && typeof module.exports !== "undefined" && module.exports || typeof global !== "undefined" && global || typeof globalThis !== "undefined" && globalThis || typeof window !== "undefined" && window || typeof self !== "undefined" && self || void 0;
3464
3708
  _top.lastCache = void 0;
3465
3709
  componentsStack = [];
3466
- resetTop = /* @__PURE__ */ __name((_top_) => {
3467
- _top = _top_;
3710
+ resetTop = /* @__PURE__ */ __name(() => {
3711
+ const globalSettings = new GlobalSettings();
3712
+ _top = _CastProps(globalSettings, _top);
3468
3713
  }, "resetTop");
3469
3714
  buildComponentsStack = /* @__PURE__ */ __name(() => {
3470
3715
  componentsStack = buildComponents(document);
@@ -3473,6 +3718,12 @@ var init_top = __esm({
3473
3718
  _top.global.configService = _configService;
3474
3719
  configService = _configService;
3475
3720
  }, "setConfigService");
3721
+ set = /* @__PURE__ */ __name((name, value) => {
3722
+ _top.set(name, value);
3723
+ }, "set");
3724
+ get = /* @__PURE__ */ __name((name, _defaultValue) => {
3725
+ return _top.get(name, _defaultValue);
3726
+ }, "get");
3476
3727
  }
3477
3728
  });
3478
3729
 
@@ -4175,248 +4426,6 @@ var init_Import = __esm({
4175
4426
  }
4176
4427
  });
4177
4428
 
4178
- // src/Service.ts
4179
- var Service, JSONService, ConfigService;
4180
- var init_Service = __esm({
4181
- "src/Service.ts"() {
4182
- "use strict";
4183
- init_basePath();
4184
- init_Crypt();
4185
- init_domain();
4186
- init_InheritClass();
4187
- init_Logger();
4188
- init_Package();
4189
- init_secretKey();
4190
- init_CONFIG();
4191
- Service = class extends InheritClass {
4192
- static {
4193
- __name(this, "Service");
4194
- }
4195
- options;
4196
- withCredentials;
4197
- useHTTP2;
4198
- // eslint-disable-next-line no-unused-vars
4199
- mockup({ request, service }) {
4200
- throw new Error("Method not implemented.");
4201
- }
4202
- name;
4203
- responseHeaders;
4204
- // eslint-disable-next-line no-unused-vars
4205
- local({ request, service }) {
4206
- throw new Error("Method not implemented.");
4207
- }
4208
- kind = "rest";
4209
- /* it can be rest, mockup, local */
4210
- domain = _domain_;
4211
- basePath = _basePath_;
4212
- url = "";
4213
- method = "GET";
4214
- data = {};
4215
- reload = false;
4216
- cached = false;
4217
- headers;
4218
- template;
4219
- // eslint-disable-next-line no-unused-vars
4220
- done({ request, service }) {
4221
- throw new Error("Method not implemented.");
4222
- }
4223
- // eslint-disable-next-line no-unused-vars
4224
- fail(...args) {
4225
- throw new Error("Method not implemented.");
4226
- }
4227
- set(name, value) {
4228
- this[name] = value;
4229
- }
4230
- get(name, _default) {
4231
- return this[name] || _default;
4232
- }
4233
- };
4234
- JSONService = class extends Service {
4235
- static {
4236
- __name(this, "JSONService");
4237
- }
4238
- method = "GET";
4239
- cached = false;
4240
- headers = {
4241
- "Content-Type": "application/json",
4242
- "charset": "utf-8"
4243
- };
4244
- JSONresponse = void 0;
4245
- done(result) {
4246
- logger.debug("***** RECEIVED RESPONSE:");
4247
- logger.debug(result.service.template);
4248
- this.JSONresponse = JSON.parse(result.service.template);
4249
- }
4250
- };
4251
- ConfigService = class extends JSONService {
4252
- static {
4253
- __name(this, "ConfigService");
4254
- }
4255
- method = "GET";
4256
- cached = false;
4257
- configFileName = "config.json";
4258
- headers = {
4259
- "Content-Type": "application/json",
4260
- "charset": "utf-8"
4261
- };
4262
- configLoaded() {
4263
- throw Error("Method not implemented.");
4264
- }
4265
- JSONresponse = void 0;
4266
- done(result) {
4267
- logger.debug("***** CONFIG LOADED:");
4268
- logger.debug(result.service.template);
4269
- this.JSONresponse = JSON.parse(result.service.template);
4270
- if (Object.hasOwn(this.JSONresponse, "__encoded__")) {
4271
- const decodedValue = _Crypt.decrypt(this.JSONresponse?.__encoded__, _secretKey);
4272
- this.JSONresponse = JSON.parse(decodedValue);
4273
- }
4274
- const jsonResponse = this.JSONresponse;
4275
- Object.keys(jsonResponse).map((k) => {
4276
- CONFIG.set(k, jsonResponse[k]);
4277
- return k;
4278
- });
4279
- this.configLoaded().catch((e) => {
4280
- throw new Error(`An error ocurred: ${e}`);
4281
- });
4282
- }
4283
- fail() {
4284
- this.configLoaded().catch((e) => {
4285
- throw new Error(`An error ocurred: ${e}`);
4286
- });
4287
- }
4288
- constructor() {
4289
- super();
4290
- this.set("url", `${this.get("basePath")}${this.get("configFileName")}`);
4291
- }
4292
- };
4293
- Package("com.qcobjects.api", [
4294
- Service
4295
- ]);
4296
- Package("com.qcobjects.api.services", [
4297
- JSONService
4298
- ]);
4299
- Package("com.qcobjects.api.config", [
4300
- ConfigService
4301
- ]);
4302
- }
4303
- });
4304
-
4305
- // src/globalSettings.ts
4306
- var GlobalSettings;
4307
- var init_globalSettings = __esm({
4308
- "src/globalSettings.ts"() {
4309
- "use strict";
4310
- init_CONFIG();
4311
- init_InheritClass();
4312
- init_Logger();
4313
- init_Package();
4314
- init_platform();
4315
- init_serviceLoader();
4316
- init_top();
4317
- init_Service();
4318
- GlobalSettings = class _GlobalSettings extends InheritClass {
4319
- static {
4320
- __name(this, "GlobalSettings");
4321
- }
4322
- static __start__() {
4323
- return _GlobalSettings.instance.__start__();
4324
- }
4325
- _GLOBAL = {};
4326
- static _instance;
4327
- static get instance() {
4328
- if (typeof _GlobalSettings._instance === "undefined") {
4329
- _GlobalSettings._instance = new _GlobalSettings();
4330
- }
4331
- return _GlobalSettings._instance;
4332
- }
4333
- set(name, value) {
4334
- this._GLOBAL[name] = value;
4335
- }
4336
- get(name, _default) {
4337
- let _value;
4338
- if (typeof this._GLOBAL[name] !== "undefined") {
4339
- _value = this._GLOBAL[name];
4340
- } else if (typeof _default !== "undefined") {
4341
- _value = _default;
4342
- }
4343
- return _value;
4344
- }
4345
- __start__() {
4346
- const __load__serviceWorker = /* @__PURE__ */ __name(function() {
4347
- let _promise;
4348
- if (isBrowser) {
4349
- _promise = new Promise(function(resolve, reject) {
4350
- if ("serviceWorker" in navigator && typeof CONFIG.get("serviceWorkerURI") !== "undefined") {
4351
- CONFIG.set("serviceWorkerScope", CONFIG.get("serviceWorkerScope") ? CONFIG.get("serviceWorkerScope") : "/");
4352
- navigator.serviceWorker.register(CONFIG.get("serviceWorkerURI"), {
4353
- scope: CONFIG.get("serviceWorkerScope")
4354
- }).then(function(registration) {
4355
- logger.debug("Service Worker Registered");
4356
- resolve.call(_promise, registration);
4357
- }, function(registration) {
4358
- logger.debug("Error registering Service Worker");
4359
- reject.call(_promise, registration);
4360
- });
4361
- navigator.serviceWorker.ready.then(function(registration) {
4362
- logger.debug("Service Worker Ready");
4363
- resolve.call(_promise, registration);
4364
- }, function(registration) {
4365
- logger.debug("Error loading Service Worker");
4366
- reject.call(_promise, registration);
4367
- });
4368
- }
4369
- });
4370
- } else {
4371
- _promise = Promise.resolve();
4372
- }
4373
- return _promise;
4374
- }, "__load__serviceWorker");
4375
- const _buildComponents = /* @__PURE__ */ __name(function() {
4376
- return new Promise((resolve) => {
4377
- if (isBrowser) {
4378
- logger.debug("Starting to building components");
4379
- try {
4380
- buildComponentsStack();
4381
- } catch (e) {
4382
- throw Error(`Something went wrong trying to start components tree: ${e.message}`);
4383
- }
4384
- logger.debug("Initializing the service worker");
4385
- __load__serviceWorker.call(_top).catch(function(e) {
4386
- logger.debug(`error loading the service worker ${e}`);
4387
- });
4388
- }
4389
- resolve();
4390
- });
4391
- }, "_buildComponents");
4392
- return new Promise((resolve) => {
4393
- logger.debug("Starting to load the config settings...");
4394
- if (CONFIG.get("useConfigService", false)) {
4395
- logger.debug("Loading settings using local configuration file...");
4396
- setConfigService(new ConfigService());
4397
- configService.configLoaded = _buildComponents;
4398
- serviceLoader(configService)?.then((standardResponse) => {
4399
- resolve(standardResponse);
4400
- })?.catch((e) => {
4401
- throw new Error(`An error ocurred while trying to load ${configService.url}: ${e}`);
4402
- });
4403
- } else {
4404
- logger.debug("Starting to load the components...");
4405
- _buildComponents.call(this).then(() => {
4406
- resolve({});
4407
- }).catch((e) => {
4408
- throw new Error(`An error ocurred while trying to build the components stack. ${e}`);
4409
- });
4410
- }
4411
- });
4412
- }
4413
- };
4414
- Package("com.qcobjects", [
4415
- GlobalSettings
4416
- ]);
4417
- }
4418
- });
4419
-
4420
4429
  // src/loadSDK.ts
4421
4430
  function loadSDK() {
4422
4431
  if (CONFIG.get("useSDK")) {
@@ -4790,7 +4799,7 @@ var require_MainProcess = __commonJS({
4790
4799
  Export(isBrowser);
4791
4800
  Export(_methods_);
4792
4801
  Export(GlobalSettings);
4793
- resetTop(_CastProps(New(GlobalSettings), _top2));
4802
+ resetTop();
4794
4803
  (function(_top3) {
4795
4804
  Object.defineProperty(_top3, "PackagesNameList", {
4796
4805
  // eslint-disable-next-line no-unused-vars
@@ -6390,6 +6399,7 @@ var getDocumentLayout = /* @__PURE__ */ __name(function() {
6390
6399
  init_mathFunctions();
6391
6400
  init_top();
6392
6401
  init_make_global();
6402
+ init_top();
6393
6403
  var QCObjects = __toESM(require_MainProcess());
6394
6404
  export {
6395
6405
  ArrayCollection,
@@ -6462,6 +6472,7 @@ export {
6462
6472
  captureFalseTouch,
6463
6473
  componentLoader,
6464
6474
  findPackageNodePath,
6475
+ get,
6465
6476
  getDocumentLayout,
6466
6477
  _top as global,
6467
6478
  isBrowser,
@@ -6475,6 +6486,7 @@ export {
6475
6486
  ready,
6476
6487
  resetTop,
6477
6488
  serviceLoader,
6489
+ set,
6478
6490
  setDefaultProcessors,
6479
6491
  shortCode,
6480
6492
  subelements,