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