@acorex/connectivity 20.0.22 → 20.0.23

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.
@@ -7,7 +7,7 @@ import * as i2 from '@acorex/platform/auth';
7
7
  import { AXPSessionService, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, AXPAuthModule } from '@acorex/platform/auth';
8
8
  import * as i0 from '@angular/core';
9
9
  import { inject, Injectable, NgModule } from '@angular/core';
10
- import { AXPLockService, AXPFileStorageStatus, AXPRegionalService, AXPFileStorageService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
10
+ import { AXPLockService, AXPFileStorageStatus, AXPFileStorageService, AXPRegionalService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
11
11
  import { AXSafePipe } from '@acorex/core/pipes';
12
12
  import { RootConfig, AXMUsersEntityService, AXMSessionStatusTypes, AXMDeviceSessionsServiceImpl, AXMDeviceSessionsService } from '@acorex/modules/security-management';
13
13
  import { AXMFormTemplateTypes, RootConfig as RootConfig$1, AXMFormTemplateManagementCategoryEntityServiceImpl, AXMFormTemplateManagementCategoryEntityService, AXMPermissionsKeys } from '@acorex/modules/form-template-management';
@@ -23,7 +23,6 @@ import { filter, throttleTime, take, of, delay, firstValueFrom } from 'rxjs';
23
23
  import { AXMPermissionsKeys as AXMPermissionsKeys$1, RootConfig as RootConfig$e } from '@acorex/modules/issue-management';
24
24
  import { RootConfig as RootConfig$7, AXMMetaDataDefinitionCategoryServiceImpl, AXMMetaDataDefinitionService, AXMMetaDataDefinitionCategoryService } from '@acorex/modules/platform-management';
25
25
  import { AXFileService } from '@acorex/core/file';
26
- import { AXTranslationService } from '@acorex/core/translation';
27
26
  import { RootConfig as RootConfig$8 } from '@acorex/modules/text-template-management';
28
27
  import { RootConfig as RootConfig$9 } from '@acorex/modules/scheduler-job-management';
29
28
  import { APPLICATION_SOURCE_NAME, MODULE_SOURCE_NAME, ENTITY_SOURCE_NAME, FEATURE_SOURCE_NAME, PERMISSION_SOURCE_NAME, PROPERTY_SOURCE_NAME, AXPModuleDesignerService } from '@acorex/modules/application-management';
@@ -31,6 +30,7 @@ import { RootConfig as RootConfig$b } from '@acorex/modules/training-management'
31
30
  import { RootConfig as RootConfig$c } from '@acorex/modules/project-management';
32
31
  import { RootConfig as RootConfig$d, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMFolderService, AXMDocumentService } from '@acorex/modules/document-management';
33
32
  import { RootConfig as RootConfig$f } from '@acorex/modules/log-management';
33
+ import { AXTranslationService } from '@acorex/core/translation';
34
34
  import { RootConfig as RootConfig$g } from '@acorex/modules/calendar-management';
35
35
  import { RootConfig as RootConfig$h } from '@acorex/modules/data-management';
36
36
  import { convertArrayToDataSource } from '@acorex/cdk/common';
@@ -195,13 +195,50 @@ class AXPDexieEntityStorageService extends Dexie {
195
195
  isCurrent: true
196
196
  });
197
197
  }
198
- async initial(entityName, collection) {
199
- const exists = await this.table('entity-store').where({ entityName }).count();
198
+ //#region ---- Initialization Methods ----
199
+ /**
200
+ * Seed the storage with the provided collection only if it has not been
201
+ * inserted before.
202
+ *
203
+ * Rather than relying on the total record count, we inspect whether the first
204
+ * item of the incoming collection (identified by its `id`) already exists in
205
+ * the table for the given `entityName`. If it exists, the data has already
206
+ * been seeded and no action is taken; otherwise, the entire collection is
207
+ * bulk-inserted.
208
+ */
209
+ async initial(entityName, collection, options = { mergeType: 'merge', uniqueKeys: ['name'] }) {
210
+ // Return early when collection is empty
211
+ if (!collection?.length) {
212
+ return collection;
213
+ }
214
+ // Build existence check based on provided unique keys rather than hard-coded `id`
215
+ const firstItem = collection[0];
216
+ const uniqueKeys = options.uniqueKeys;
217
+ let exists = 0;
218
+ if (await this.table('entity-store').where({ entityName }).count() > 0) {
219
+ for (const key of uniqueKeys) {
220
+ const existingRecord = await this.table('entity-store')
221
+ .where({ entityName })
222
+ .filter((rec) => rec[key] === firstItem[key])
223
+ .first();
224
+ if (existingRecord) {
225
+ exists = 1;
226
+ break; // Stop iterating once a match is found
227
+ }
228
+ }
229
+ }
200
230
  if (exists === 0) {
201
- await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
231
+ if (options?.mergeType === 'merge') {
232
+ await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
233
+ }
234
+ else {
235
+ await this.table('entity-store').where({ entityName }).delete();
236
+ await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
237
+ }
202
238
  }
203
239
  return collection;
204
240
  }
241
+ //#endregion
205
242
  async getOne(entityName, id) {
206
243
  return await this.table('entity-store').where({ entityName, id: id }).first();
207
244
  }
@@ -6596,100 +6633,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6596
6633
  type: Injectable
6597
6634
  }], ctorParameters: () => [] });
6598
6635
 
6599
- class AXCRegionalServiceImpl extends AXPRegionalService {
6600
- constructor() {
6601
- super(...arguments);
6602
- this.languageService = inject(AXTranslationService);
6603
- }
6604
- async getCountries() {
6605
- const lang = await firstValueFrom(this.languageService.langChanges$);
6606
- const { countries } = await import('./acorex-connectivity-mock-countries-DHRrtbwM.mjs');
6607
- return countries.map((country) => {
6608
- if (lang == country.regional) {
6609
- return {
6610
- ...country,
6611
- title: country.native,
6612
- };
6613
- }
6614
- else {
6615
- return country;
6616
- }
6617
- });
6618
- }
6619
- async getProvinces(countryId) {
6620
- const lang = await firstValueFrom(this.languageService.langChanges$);
6621
- const country = await this.getCountries();
6622
- const data = country
6623
- .filter((c) => !countryId || c.code === countryId)
6624
- .flatMap((c) => c.provinces?.map((province) => {
6625
- if (lang == c.regional) {
6626
- return {
6627
- ...province,
6628
- title: province.native,
6629
- };
6630
- }
6631
- else {
6632
- return province;
6633
- }
6634
- }) ?? []);
6635
- return data;
6636
- }
6637
- async getCities(filter = {}) {
6638
- const { countryId, provinceId } = filter;
6639
- const countries = await this.getCountries();
6640
- const lang = await firstValueFrom(this.languageService.langChanges$);
6641
- const filteredCountries = countryId ? countries.filter((c) => c.code === countryId) : countries;
6642
- const provinces = filteredCountries.flatMap((c) => c.provinces ?? []);
6643
- const filteredProvinces = provinceId ? provinces.filter((p) => p.code === provinceId) : provinces;
6644
- filteredProvinces.forEach((province) => {
6645
- province.cities = province.cities?.map((city) => {
6646
- const country = countries.find((c) => c.provinces?.some((p) => p.code === province.code));
6647
- if (country && lang == country.regional) {
6648
- return {
6649
- ...city,
6650
- title: city.native,
6651
- };
6652
- }
6653
- else {
6654
- return city;
6655
- }
6656
- });
6657
- });
6658
- return filteredProvinces.flatMap((p) => p.cities ?? []);
6659
- }
6660
- async getCurrencies() {
6661
- const { currencies } = await import('./acorex-connectivity-mock-currencies-B-x3Mxql.mjs');
6662
- return currencies;
6663
- }
6664
- async getLocaleProfiles() {
6665
- const { profiles } = await import('./acorex-connectivity-mock-profiles-MJ9xFTtp.mjs');
6666
- return profiles.filter((c) => ['en-US', 'fa-IR'].some((e) => e == c.localeInfo.code));
6667
- }
6668
- async getLanguages() {
6669
- return (await this.getLocaleProfiles()).map((c) => ({ code: c.localeInfo.code, title: c.title }));
6670
- }
6671
- async getAvailableLanguages() {
6672
- return (await this.getLanguages()).filter((c) => ['fa-IR', 'en-US'].some((e) => e == c.code));
6673
- }
6674
- async getTimeZones() {
6675
- const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
6676
- return timeZones;
6677
- }
6678
- async getBrowserTimeZoneCode() {
6679
- const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
6680
- const now = new Date();
6681
- // Calculate offset in hours and minutes
6682
- const offsetMinutes = now.getTimezoneOffset();
6683
- const offsetHours = Math.floor(-offsetMinutes / 60);
6684
- const offsetRemainder = Math.abs(offsetMinutes % 60);
6685
- // Format the offset properly
6686
- const formattedOffset = `UTC${offsetHours >= 0 ? '+' : ''}${offsetHours}${offsetRemainder ? `:${offsetRemainder.toString().padStart(2, '0')}` : ''}`;
6687
- // Find matching time zone
6688
- const matchedZone = timeZones.find((zone) => zone.code === formattedOffset);
6689
- return matchedZone ? matchedZone.code : 'UTC';
6690
- }
6691
- }
6692
-
6693
6636
  class AXCPlatformManagementMockModule {
6694
6637
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
6695
6638
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule }); }
@@ -6722,10 +6665,6 @@ class AXCPlatformManagementMockModule {
6722
6665
  provide: AXPFileStorageService,
6723
6666
  useClass: AXCFileStorageService,
6724
6667
  },
6725
- {
6726
- provide: AXPRegionalService,
6727
- useClass: AXCRegionalServiceImpl,
6728
- },
6729
6668
  ] }); }
6730
6669
  }
6731
6670
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, decorators: [{
@@ -6763,10 +6702,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6763
6702
  provide: AXPFileStorageService,
6764
6703
  useClass: AXCFileStorageService,
6765
6704
  },
6766
- {
6767
- provide: AXPRegionalService,
6768
- useClass: AXCRegionalServiceImpl,
6769
- },
6770
6705
  ],
6771
6706
  }]
6772
6707
  }] });
@@ -8537,6 +8472,7 @@ const DOCUMENT_TYPES = [
8537
8472
  title: 'Risk Assessment Report',
8538
8473
  maxSize: 5000,
8539
8474
  isEncrypted: false,
8475
+ enableVersioning: true,
8540
8476
  isMultiple: true,
8541
8477
  meta: [
8542
8478
  {
@@ -8580,6 +8516,7 @@ const DOCUMENT_TYPES = [
8580
8516
  title: 'Upload File',
8581
8517
  maxSize: 50000,
8582
8518
  isEncrypted: false,
8519
+ enableVersioning: false,
8583
8520
  isMultiple: false,
8584
8521
  meta: [],
8585
8522
  type: {
@@ -9845,6 +9782,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9845
9782
  type: Injectable
9846
9783
  }], ctorParameters: () => [] });
9847
9784
 
9785
+ class AXCRegionalServiceImpl extends AXPRegionalService {
9786
+ constructor() {
9787
+ super(...arguments);
9788
+ this.languageService = inject(AXTranslationService);
9789
+ }
9790
+ async getCountries() {
9791
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9792
+ const { countries } = await import('./acorex-connectivity-mock-countries-DHRrtbwM.mjs');
9793
+ return countries.map((country) => {
9794
+ if (lang == country.regional) {
9795
+ return {
9796
+ ...country,
9797
+ title: country.native,
9798
+ };
9799
+ }
9800
+ else {
9801
+ return country;
9802
+ }
9803
+ });
9804
+ }
9805
+ async getProvinces(countryId) {
9806
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9807
+ const country = await this.getCountries();
9808
+ const data = country
9809
+ .filter((c) => !countryId || c.code === countryId)
9810
+ .flatMap((c) => c.provinces?.map((province) => {
9811
+ if (lang == c.regional) {
9812
+ return {
9813
+ ...province,
9814
+ title: province.native,
9815
+ };
9816
+ }
9817
+ else {
9818
+ return province;
9819
+ }
9820
+ }) ?? []);
9821
+ return data;
9822
+ }
9823
+ async getCities(filter = {}) {
9824
+ const { countryId, provinceId } = filter;
9825
+ const countries = await this.getCountries();
9826
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9827
+ const filteredCountries = countryId ? countries.filter((c) => c.code === countryId) : countries;
9828
+ const provinces = filteredCountries.flatMap((c) => c.provinces ?? []);
9829
+ const filteredProvinces = provinceId ? provinces.filter((p) => p.code === provinceId) : provinces;
9830
+ filteredProvinces.forEach((province) => {
9831
+ province.cities = province.cities?.map((city) => {
9832
+ const country = countries.find((c) => c.provinces?.some((p) => p.code === province.code));
9833
+ if (country && lang == country.regional) {
9834
+ return {
9835
+ ...city,
9836
+ title: city.native,
9837
+ };
9838
+ }
9839
+ else {
9840
+ return city;
9841
+ }
9842
+ });
9843
+ });
9844
+ return filteredProvinces.flatMap((p) => p.cities ?? []);
9845
+ }
9846
+ async getCurrencies() {
9847
+ const { currencies } = await import('./acorex-connectivity-mock-currencies-B-x3Mxql.mjs');
9848
+ return currencies;
9849
+ }
9850
+ async getLocaleProfiles() {
9851
+ const { profiles } = await import('./acorex-connectivity-mock-profiles-MJ9xFTtp.mjs');
9852
+ return profiles.filter((c) => ['en-US', 'fa-IR'].some((e) => e == c.localeInfo.code));
9853
+ }
9854
+ async getLanguages() {
9855
+ return (await this.getLocaleProfiles()).map((c) => ({ code: c.localeInfo.code, title: c.title }));
9856
+ }
9857
+ async getAvailableLanguages() {
9858
+ return (await this.getLanguages()).filter((c) => ['fa-IR', 'en-US'].some((e) => e == c.code));
9859
+ }
9860
+ async getTimeZones() {
9861
+ const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
9862
+ return timeZones;
9863
+ }
9864
+ async getBrowserTimeZoneCode() {
9865
+ const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
9866
+ const now = new Date();
9867
+ // Calculate offset in hours and minutes
9868
+ const offsetMinutes = now.getTimezoneOffset();
9869
+ const offsetHours = Math.floor(-offsetMinutes / 60);
9870
+ const offsetRemainder = Math.abs(offsetMinutes % 60);
9871
+ // Format the offset properly
9872
+ const formattedOffset = `UTC${offsetHours >= 0 ? '+' : ''}${offsetHours}${offsetRemainder ? `:${offsetRemainder.toString().padStart(2, '0')}` : ''}`;
9873
+ // Find matching time zone
9874
+ const matchedZone = timeZones.find((zone) => zone.code === formattedOffset);
9875
+ return matchedZone ? matchedZone.code : 'UTC';
9876
+ }
9877
+ }
9878
+
9848
9879
  class AXCCommonMockModule {
9849
9880
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9850
9881
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule }); }
@@ -9863,6 +9894,10 @@ class AXCCommonMockModule {
9863
9894
  provide: AXPLockService,
9864
9895
  useClass: AXCLockService,
9865
9896
  },
9897
+ {
9898
+ provide: AXPRegionalService,
9899
+ useClass: AXCRegionalServiceImpl
9900
+ }
9866
9901
  ] }); }
9867
9902
  }
9868
9903
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, decorators: [{
@@ -9886,6 +9921,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9886
9921
  provide: AXPLockService,
9887
9922
  useClass: AXCLockService,
9888
9923
  },
9924
+ {
9925
+ provide: AXPRegionalService,
9926
+ useClass: AXCRegionalServiceImpl
9927
+ }
9889
9928
  ],
9890
9929
  }]
9891
9930
  }] });