From 260a596d6c103942a4ebbbf8aa3df55c981af4a9 Mon Sep 17 00:00:00 2001 From: WorthyD Date: Sat, 27 Apr 2024 20:33:38 -0500 Subject: [PATCH] chore: migrating models and db stuff --- .../src/app/app.providers.ts | 2 +- .../profile-worker.service.mock.ts | 2 +- .../profile-worker/profile-worker.service.ts | 2 +- libs/data/src/lib/clan/base-clan.service.ts | 10 ++-- .../lib/clan/base-member-activity.service.ts | 16 +++--- .../bungie-info/bungie-info.service.spec.ts | 5 +- .../clan/bungie-info/bungie-info.service.ts | 9 ++-- libs/data/src/lib/clan/clan-database.ts | 18 +++---- .../clan-details/clan-detail-serializer.ts | 2 +- .../clan-details/clan-details.service.spec.ts | 2 +- .../clan/clan-details/clan-details.service.ts | 4 +- .../clan-member-activity.serializer.ts | 3 +- .../clan-member-recent-activity.serializer.ts | 4 +- .../clan-member-recent-activity.service.ts | 6 +-- .../clan/clan-members/clan-members.service.ts | 8 +-- .../src/lib/clan/profiles/profile.service.ts | 6 +-- .../lib/manifest/manifest-loader.service.ts | 2 +- libs/data/src/lib/models/Character.ts | 3 -- .../src/lib/models/ClanMemberSeasonPass.ts | 6 --- .../src/lib/models/CollectionDefinition.ts | 3 -- .../lib/models/MemberActivityRecentStats.ts | 12 ----- libs/data/src/lib/models/MemberProfile.ts | 51 ------------------- libs/data/src/lib/models/RecordDefinition.ts | 3 -- libs/data/src/lib/models/SealDefinition.ts | 3 -- .../src/lib/models/__mocks__/bungie-info.ts | 10 ---- libs/data/src/lib/models/__mocks__/index.ts | 1 - .../src/lib/models/__mocks__/public-api.ts | 2 - libs/data/src/lib/models/enums/index.ts | 1 - libs/data/src/lib/models/enums/public-api.ts | 1 - libs/data/src/lib/models/index.ts | 13 ----- libs/data/src/lib/models/public-api.ts | 1 - .../src/lib/profile/cached-profile.service.ts | 5 +- libs/data/src/lib/profile/profile.service.ts | 2 +- .../stat-aggregators/clan-activity.service.ts | 2 +- .../base-clan-aggregate-time.service.spec.ts | 2 +- .../base-clan-aggregate-time.service.ts | 2 +- .../daily-clan-aggregate-time.service.ts | 2 +- libs/data/src/lib/storage/index.ts | 1 - libs/data/src/lib/storage/public-api.ts | 2 - .../lib/activity-breakdown-list.component.ts | 2 +- .../table/src/lib/activity-table.component.ts | 2 +- .../src/lib/activity-mode.service.ts | 2 +- .../models/src/lib/ProfileActivityMode.ts | 3 +- .../clan-roster-metadata/ClanRosterViewer.ts | 2 +- .../src/lib/clans-roster.service.ts | 2 +- .../models/src/lib/ClanRosterItem.ts | 2 +- .../lib/class-cell/class-cell.component.ts | 2 +- .../src/lib/player-overview.component.ts | 2 +- .../shell/src/lib/player-shell.module.ts | 2 +- .../member-overview.component.ts | 6 +-- .../RecentActivityExporter.ts | 1 - .../models/src/lib/profile-recent-activity.ts | 3 +- .../data-access/src/lib/seals.service.ts | 2 +- .../clan-members-profiles.selectors.ts | 2 +- .../clans-with-members-profiles.state.ts | 2 +- libs/dcd/shared/mocks/src/lib/Character.ts | 2 +- .../mocks/src/lib}/activity-definition.ts | 0 libs/dcd/shared/mocks/src/lib/bungie-info.ts | 10 ++++ .../shared/mocks/src/lib}/clan-details.ts | 3 +- .../mocks/src/lib}/seal-definition.mock.ts | 5 +- libs/dcd/shared/models/src/index.ts | 17 +++++++ .../shared/models/src/lib}/ActivityStats.ts | 0 .../shared/models/src/lib}/BungieInfo.ts | 0 libs/dcd/shared/models/src/lib/Character.ts | 5 ++ .../shared/models/src/lib}/ClanDetails.ts | 0 .../shared/models/src/lib}/ClanMember.ts | 0 .../models/src/lib/ClanMemberProfile.ts | 2 +- .../models/src/lib/CollectionDefinition.ts | 5 ++ .../shared/models/src/lib}/DeepPartial.ts | 0 .../src/lib}/DestinyActivityModeCategory.ts | 0 .../src/lib}/DestinyActivityModeType.ts | 0 ...lStatsDestinyHistoricalStatsPeriodGroup.ts | 0 .../src/lib/MemberActivityRecentStats.ts | 12 +++++ .../models/src/lib}/MemberActivityStat.ts | 10 ++-- .../models/src/lib}/MemberActivityTime.ts | 0 .../models/src/lib}/MetricDefinition.ts | 0 .../shared/models/src/lib/RecordDefinition.ts | 5 ++ .../models/src/lib}/enums/MembershipTypes.ts | 0 .../shared/models/src/lib}/time.ts | 0 .../lib/bungie-info/bungie-info.component.ts | 2 +- .../character-card.component.ts | 2 +- .../player-seals/member-profile.converter.ts | 2 +- .../src/lib/profile-link.component.ts | 2 +- .../dcd/shared/utils/legacy-db/.eslintrc.json | 33 ++++++++++++ libs/dcd/shared/utils/legacy-db/README.md | 7 +++ .../dcd/shared/utils/legacy-db/jest.config.ts | 22 ++++++++ libs/dcd/shared/utils/legacy-db/project.json | 20 ++++++++ libs/dcd/shared/utils/legacy-db/src/index.ts | 3 ++ .../legacy-db/src/lib}/app-indexed-db.ts | 0 .../legacy-db/src/lib}/base-indexed-db.ts | 0 .../legacy-db/src/lib}/clan-indexed-db.ts | 0 .../shared/utils/legacy-db/src/test-setup.ts | 8 +++ libs/dcd/shared/utils/legacy-db/tsconfig.json | 29 +++++++++++ .../shared/utils/legacy-db/tsconfig.lib.json | 12 +++++ .../shared/utils/legacy-db/tsconfig.spec.json | 11 ++++ .../bungie-display-name.pipe.ts | 2 +- .../bungie-profile-url.pipe.ts | 2 +- .../d2-checklist-url/d2-checklist-url.pipe.ts | 2 +- .../destiny-tracker-url.pipe.ts | 5 +- .../dungeon-report-url/base-dungeon-report.ts | 2 +- .../dungeon-report-profile-url.pipe.ts | 3 +- .../dungeon-report-url.pipe.ts | 2 +- .../in-collections-total.pipe.ts | 2 +- .../src/lib/member-type/member-type.pipe.ts | 2 +- .../src/lib/metric-total/metric-total.pipe.ts | 2 +- .../base-raid-report-url.pipe.ts | 2 +- .../raid-report-url/base-raid-report-url.ts | 2 +- .../raid-report-profile-url.pipe.ts | 2 +- .../raid-report-url/raid-report-url.pipe.ts | 2 +- .../src/lib/record-total/record-total.pipe.ts | 2 +- .../lib/triumph-report/triumph-report.pipe.ts | 3 +- libs/dcd/shared/utils/storage/.eslintrc.json | 33 ++++++++++++ libs/dcd/shared/utils/storage/README.md | 7 +++ libs/dcd/shared/utils/storage/jest.config.ts | 22 ++++++++ libs/dcd/shared/utils/storage/project.json | 20 ++++++++ libs/dcd/shared/utils/storage/src/index.ts | 2 + .../storage/src/lib}/datastore.interface.ts | 0 .../src/lib}/idb-key-val.service.spec.ts | 0 .../storage/src/lib}/idb-key-val.service.ts | 0 .../src/lib}/local-storage.service.spec.ts | 0 .../storage/src/lib}/local-storage.service.ts | 0 .../shared/utils/storage/src/test-setup.ts | 8 +++ libs/dcd/shared/utils/storage/tsconfig.json | 29 +++++++++++ .../shared/utils/storage/tsconfig.lib.json | 12 +++++ .../shared/utils/storage/tsconfig.spec.json | 11 ++++ tsconfig.base.json | 2 + 126 files changed, 454 insertions(+), 224 deletions(-) delete mode 100644 libs/data/src/lib/models/Character.ts delete mode 100644 libs/data/src/lib/models/ClanMemberSeasonPass.ts delete mode 100644 libs/data/src/lib/models/CollectionDefinition.ts delete mode 100644 libs/data/src/lib/models/MemberActivityRecentStats.ts delete mode 100644 libs/data/src/lib/models/MemberProfile.ts delete mode 100644 libs/data/src/lib/models/RecordDefinition.ts delete mode 100644 libs/data/src/lib/models/SealDefinition.ts delete mode 100644 libs/data/src/lib/models/__mocks__/bungie-info.ts delete mode 100644 libs/data/src/lib/models/__mocks__/index.ts delete mode 100644 libs/data/src/lib/models/__mocks__/public-api.ts delete mode 100644 libs/data/src/lib/models/enums/index.ts delete mode 100644 libs/data/src/lib/models/enums/public-api.ts delete mode 100644 libs/data/src/lib/models/index.ts delete mode 100644 libs/data/src/lib/models/public-api.ts delete mode 100644 libs/data/src/lib/storage/index.ts delete mode 100644 libs/data/src/lib/storage/public-api.ts rename libs/{data/src/lib/models/__mocks__ => dcd/shared/mocks/src/lib}/activity-definition.ts (100%) create mode 100644 libs/dcd/shared/mocks/src/lib/bungie-info.ts rename libs/{data/src/lib/models/__mocks__ => dcd/shared/mocks/src/lib}/clan-details.ts (95%) rename libs/{data/src/lib/models/__mocks__ => dcd/shared/mocks/src/lib}/seal-definition.mock.ts (97%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/ActivityStats.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/BungieInfo.ts (100%) create mode 100644 libs/dcd/shared/models/src/lib/Character.ts rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/ClanDetails.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/ClanMember.ts (100%) create mode 100644 libs/dcd/shared/models/src/lib/CollectionDefinition.ts rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/DeepPartial.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/DestinyActivityModeCategory.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/DestinyActivityModeType.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup.ts (100%) create mode 100644 libs/dcd/shared/models/src/lib/MemberActivityRecentStats.ts rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/MemberActivityStat.ts (76%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/MemberActivityTime.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/MetricDefinition.ts (100%) create mode 100644 libs/dcd/shared/models/src/lib/RecordDefinition.ts rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/enums/MembershipTypes.ts (100%) rename libs/{data/src/lib/models => dcd/shared/models/src/lib}/time.ts (100%) create mode 100644 libs/dcd/shared/utils/legacy-db/.eslintrc.json create mode 100644 libs/dcd/shared/utils/legacy-db/README.md create mode 100644 libs/dcd/shared/utils/legacy-db/jest.config.ts create mode 100644 libs/dcd/shared/utils/legacy-db/project.json create mode 100644 libs/dcd/shared/utils/legacy-db/src/index.ts rename libs/{data/src/lib/db => dcd/shared/utils/legacy-db/src/lib}/app-indexed-db.ts (100%) rename libs/{data/src/lib/db => dcd/shared/utils/legacy-db/src/lib}/base-indexed-db.ts (100%) rename libs/{data/src/lib/db => dcd/shared/utils/legacy-db/src/lib}/clan-indexed-db.ts (100%) create mode 100644 libs/dcd/shared/utils/legacy-db/src/test-setup.ts create mode 100644 libs/dcd/shared/utils/legacy-db/tsconfig.json create mode 100644 libs/dcd/shared/utils/legacy-db/tsconfig.lib.json create mode 100644 libs/dcd/shared/utils/legacy-db/tsconfig.spec.json create mode 100644 libs/dcd/shared/utils/storage/.eslintrc.json create mode 100644 libs/dcd/shared/utils/storage/README.md create mode 100644 libs/dcd/shared/utils/storage/jest.config.ts create mode 100644 libs/dcd/shared/utils/storage/project.json create mode 100644 libs/dcd/shared/utils/storage/src/index.ts rename libs/{data/src/lib/storage => dcd/shared/utils/storage/src/lib}/datastore.interface.ts (100%) rename libs/{data/src/lib/storage => dcd/shared/utils/storage/src/lib}/idb-key-val.service.spec.ts (100%) rename libs/{data/src/lib/storage => dcd/shared/utils/storage/src/lib}/idb-key-val.service.ts (100%) rename libs/{data/src/lib/storage => dcd/shared/utils/storage/src/lib}/local-storage.service.spec.ts (100%) rename libs/{data/src/lib/storage => dcd/shared/utils/storage/src/lib}/local-storage.service.ts (100%) create mode 100644 libs/dcd/shared/utils/storage/src/test-setup.ts create mode 100644 libs/dcd/shared/utils/storage/tsconfig.json create mode 100644 libs/dcd/shared/utils/storage/tsconfig.lib.json create mode 100644 libs/dcd/shared/utils/storage/tsconfig.spec.json diff --git a/apps/destiny-clan-dashboard/src/app/app.providers.ts b/apps/destiny-clan-dashboard/src/app/app.providers.ts index a98fe08c..fbf617f0 100644 --- a/apps/destiny-clan-dashboard/src/app/app.providers.ts +++ b/apps/destiny-clan-dashboard/src/app/app.providers.ts @@ -20,7 +20,7 @@ import { ProfileWorkerService } from './workers/profile-worker/profile-worker.se import { ProfileRecentActivityWorkerService as ProfileRecentActivityWorkerServiceFake } from '@dcd/shared/data-access/member-activity'; import { ProfileRecentActivityWorkerService } from './workers/profile-recent-activity/profile-recent-activity.service'; import { LocationToken, WindowToken, locationProvider, windowProvider } from '@dcd/shared/tokens'; -import { IdbKeyValService } from '@destiny-clan-dashboard/data/storage'; +import { IdbKeyValService } from '@dcd/shared/utils/storage'; import { ClanMembersService } from '@destiny-clan-dashboard/data/clan/clan-members'; import { ApiKeyInterceptor } from '@dcd/shared/utils/api-key-interceptor'; import { ClanDatabase } from '@destiny-clan-dashboard/data/clan/clan-database'; diff --git a/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.mock.ts b/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.mock.ts index 790ec2bd..70dfe726 100644 --- a/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.mock.ts +++ b/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.mock.ts @@ -1,5 +1,5 @@ import { BehaviorSubject, delay, of, take, tap } from 'rxjs'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; export class ProfileWorkerServiceMock { constructor() {} diff --git a/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.ts b/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.ts index 7db6c1b4..46e6542c 100644 --- a/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.ts +++ b/apps/destiny-clan-dashboard/src/app/workers/profile-worker/profile-worker.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; //import { MemberProfile, ClanMember } from 'bungie-models'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; import { environment } from '../../../environments/environment'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { SeasonService } from '@dcd/shared/data-access/definitions'; @Injectable() diff --git a/libs/data/src/lib/clan/base-clan.service.ts b/libs/data/src/lib/clan/base-clan.service.ts index 92e523ac..6b0ab847 100644 --- a/libs/data/src/lib/clan/base-clan.service.ts +++ b/libs/data/src/lib/clan/base-clan.service.ts @@ -1,22 +1,22 @@ import { ClanDatabase } from './clan-database'; -import { DBObject, StoreId } from '../db/clan-indexed-db'; +import { ClanDbObject, ClanStoreId } from '@dcd/shared/utils/legacy-db'; import { isValidDate, nowPlusMinutes } from '@destiny-clan-dashboard/shared/utils'; export class BaseClanService { tableName; - constructor(private clanDbBase: ClanDatabase, private tableNameBase: StoreId) { + constructor(private clanDbBase: ClanDatabase, private tableNameBase: ClanStoreId) { this.tableName = tableNameBase; } - getDataFromCache(clanId: string, rowId: string): Promise { + getDataFromCache(clanId: string, rowId: string): Promise { return this.clanDbBase.getById(clanId, this.tableNameBase, rowId); } - getAllDataFromCache(clanId: string): Promise { + getAllDataFromCache(clanId: string): Promise { return this.clanDbBase.getAll(clanId, this.tableNameBase); } - isCacheValid(cachedData: DBObject, minuteExpiration: number, lastActivity?: Date) { + isCacheValid(cachedData: ClanDbObject, minuteExpiration: number, lastActivity?: Date) { if (cachedData && cachedData.createDate) { const cacheDate = cachedData.createDate; let expireDate; diff --git a/libs/data/src/lib/clan/base-member-activity.service.ts b/libs/data/src/lib/clan/base-member-activity.service.ts index 4e1b01b6..8d673108 100644 --- a/libs/data/src/lib/clan/base-member-activity.service.ts +++ b/libs/data/src/lib/clan/base-member-activity.service.ts @@ -9,9 +9,9 @@ import { groupActivitiesByDate } from '@destiny-clan-dashboard/shared/utils'; import { mergeMap, map, catchError, toArray, switchMap, tap } from 'rxjs/operators'; import { Observable, of, from, defer, concat, EMPTY, forkJoin } from 'rxjs'; import { ClanDatabase } from './clan-database'; -import { DBObject, StoreId } from '../db/clan-indexed-db'; -import { MemberActivityStats } from '../models/MemberActivityStat'; -import { MemberActivityTime } from '../models/MemberActivityTime'; +import { ClanDbObject, ClanStoreId } from '@dcd/shared/utils/legacy-db'; +import { MemberActivityStats } from '@dcd/shared/models'; +import { MemberActivityTime } from '@dcd/shared/models'; import { clanMemberActivitySerializer } from './clan-member-activity/clan-member-activity.serializer'; //import { MemberProfile } from '../models'; //import { clanMemberActivitySerializer } from './clan-member-activity/clan-member-activity.serializer'; @@ -29,7 +29,7 @@ export class BaseMemberActivityService extends BaseClanService { private ACTIVITY_GET_COUNT = 250; constructor( private clanDbPBase: ClanDatabase, - private tableNamePBase: StoreId, + private tableNamePBase: ClanStoreId, private apiKey: string, // private d2ServiceBase: Destiny2Service, public startValue: Date, @@ -154,7 +154,7 @@ export class BaseMemberActivityService extends BaseClanService { * Determines if Cached data is fresh enough to use. Triggers new call if too old. * */ - verifyCacheIntegrity(clanId, memberProfile: MemberProfile, characterId, cachedData: DBObject) { + verifyCacheIntegrity(clanId, memberProfile: MemberProfile, characterId, cachedData: ClanDbObject) { const characterActivityId = this.getMemberActivityId(memberProfile, characterId); if (this.isCacheValid(cachedData, 720, new Date(memberProfile.profile.data.dateLastPlayed))) { return of(cachedData.data); @@ -171,7 +171,7 @@ export class BaseMemberActivityService extends BaseClanService { member: MemberProfile, characterId: number, characterActivityId: string, - cachedData: DBObject + cachedData: ClanDbObject //): Observable> { ): Observable> { return this.getAllRecentActivity(member, characterId).pipe( @@ -203,7 +203,7 @@ export class BaseMemberActivityService extends BaseClanService { groupActivitiesToMember( memberProfile: MemberProfile, - allActivities: DBObject[], + allActivities: ClanDbObject[], activityMode: number = 0, activityTypeId: number = 0 ) { @@ -242,7 +242,7 @@ export class BaseMemberActivityService extends BaseClanService { groupActivitiesToMembers( memberProfiles: MemberProfile[], - allActivities: DBObject[], + allActivities: ClanDbObject[], activityMode: number = 0, activityTypeId = 0 ): any[] { diff --git a/libs/data/src/lib/clan/bungie-info/bungie-info.service.spec.ts b/libs/data/src/lib/clan/bungie-info/bungie-info.service.spec.ts index fa78a440..38fc07f0 100644 --- a/libs/data/src/lib/clan/bungie-info/bungie-info.service.spec.ts +++ b/libs/data/src/lib/clan/bungie-info/bungie-info.service.spec.ts @@ -1,12 +1,13 @@ import { ClanBungieInfoService } from './bungie-info.service'; import { ClanDatabase } from '../clan-database'; -import { DBObject } from '../../db/clan-indexed-db'; +import { ClanDbObject } from '@dcd/shared/utils/legacy-db'; + import { BungieInfo } from '../../models/BungieInfo'; import { ClanMember } from '../../models'; jest.mock('../clan-database'); const mockedDatabase = ClanDatabase as jest.Mock; -const getMockClanObject: (id?: string, createDate?: Date, data?: BungieInfo) => Partial = ( +const getMockClanObject: (id?: string, createDate?: Date, data?: BungieInfo) => Partial = ( id = '', createDate = new Date(), data = {} diff --git a/libs/data/src/lib/clan/bungie-info/bungie-info.service.ts b/libs/data/src/lib/clan/bungie-info/bungie-info.service.ts index 32893858..0edb4f8d 100644 --- a/libs/data/src/lib/clan/bungie-info/bungie-info.service.ts +++ b/libs/data/src/lib/clan/bungie-info/bungie-info.service.ts @@ -2,14 +2,15 @@ import { map, catchError, mergeMap, bufferTime, toArray } from 'rxjs/operators'; import { Observable, from, of, throwError } from 'rxjs'; // import { profileSerializer } from './profile.serializer'; import { isValidDate, nowPlusDays, unixTimeStampToDate } from '@destiny-clan-dashboard/shared/utils'; -import { StoreId } from '../../db/clan-indexed-db'; +import { ClanStoreId } from '@dcd/shared/utils/legacy-db'; import { ClanDatabase } from '../clan-database'; -import { ClanMember } from '../../models/ClanMember'; -import { BungieInfo } from '../../models/BungieInfo'; +import { ClanMember } from '@dcd/shared/models'; +import { BungieInfo } from '@dcd/shared/models'; +//import { BungieInfo } from '../../models/BungieInfo'; interface MemberProfile {} export class ClanBungieInfoService { - private tableName: StoreId = StoreId.BungieInfo; + private tableName: ClanStoreId = ClanStoreId.BungieInfo; private concurrentRequests = 20; private CACHE_EXPIRATION = -1; diff --git a/libs/data/src/lib/clan/clan-database.ts b/libs/data/src/lib/clan/clan-database.ts index a978746d..caeb79b7 100644 --- a/libs/data/src/lib/clan/clan-database.ts +++ b/libs/data/src/lib/clan/clan-database.ts @@ -1,31 +1,31 @@ // import { Injectable } from '@angular/core'; -import { AppIndexedDb, StoreId, DBObject, STORE_IDS } from '../db/clan-indexed-db'; +import { ClanIndexedDb, ClanStoreId, ClanDbObject, CLAN_STORE_IDS } from '@dcd/shared/utils/legacy-db' // @Injectable({providedIn: 'root'}) export class ClanDatabase { - private databases: { [key: string]: AppIndexedDb }; + private databases: { [key: string]: ClanIndexedDb }; // private database: AppIndexedDb; constructor() { this.databases = {}; } - getAll(repository: string, type: StoreId): Promise { + getAll(repository: string, type: ClanStoreId): Promise { return this.getDatabase(repository).getAllData(type); } - getById(repository: string, type: StoreId, id: string): Promise { + getById(repository: string, type: ClanStoreId, id: string): Promise { return this.getDatabase(repository).getById(type, id); } - update(repository: string, type: StoreId, entities: any[]): Promise { + update(repository: string, type: ClanStoreId, entities: any[]): Promise { return this.getDatabase(repository).updateValues(entities, type); } - remove(repository: string, type: StoreId, ids: string[]): Promise { + remove(repository: string, type: ClanStoreId, ids: string[]): Promise { return this.getDatabase(repository).removeValues(ids, type); } - removeAll(repository: string, type: StoreId) { + removeAll(repository: string, type: ClanStoreId) { return this.getDatabase(repository).removeAllValues(type); } @@ -34,7 +34,7 @@ export class ClanDatabase { } purgeDatabase(repository: string) { - STORE_IDS.forEach((storeId) => { + CLAN_STORE_IDS.forEach((storeId) => { this.getDatabase(repository, false).removeAllValues(storeId); }); } @@ -43,7 +43,7 @@ export class ClanDatabase { if (this.databases && this.databases[repository]) { return this.databases[repository]; } - const newDB = new AppIndexedDb(repository, initializeValues); + const newDB = new ClanIndexedDb(repository, initializeValues); this.databases[repository] = newDB; return this.databases[repository]; } diff --git a/libs/data/src/lib/clan/clan-details/clan-detail-serializer.ts b/libs/data/src/lib/clan/clan-details/clan-detail-serializer.ts index 80c9c23f..afcbe702 100644 --- a/libs/data/src/lib/clan/clan-details/clan-detail-serializer.ts +++ b/libs/data/src/lib/clan/clan-details/clan-detail-serializer.ts @@ -1,5 +1,5 @@ import { GroupsV2GroupV2, GroupsV2GroupV2ClanInfoAndInvestment } from 'bungie-api-angular'; -import { ClanDetails } from '../../models/ClanDetails'; +import { ClanDetails } from '@dcd/shared/models'; export function clanDetailSerializer(group: GroupsV2GroupV2, progressionHashes: string[]): ClanDetails { return { diff --git a/libs/data/src/lib/clan/clan-details/clan-details.service.spec.ts b/libs/data/src/lib/clan/clan-details/clan-details.service.spec.ts index 43d297f5..f2cf2f33 100644 --- a/libs/data/src/lib/clan/clan-details/clan-details.service.spec.ts +++ b/libs/data/src/lib/clan/clan-details/clan-details.service.spec.ts @@ -5,7 +5,7 @@ import { GroupV2Service } from 'bungie-api-angular'; import { ClanDatabase } from '../clan-database'; import { ClanDetailsService } from './clan-details.service'; import { DBObject } from '../../db/clan-indexed-db'; -import { ClanDetails } from '../../models/ClanDetails'; +import { ClanDetails } from '@dcd/shared/models'; import { getMockClan } from '../../models/__mocks__/clan-details'; import { defer, of } from 'rxjs'; diff --git a/libs/data/src/lib/clan/clan-details/clan-details.service.ts b/libs/data/src/lib/clan/clan-details/clan-details.service.ts index e8197729..05b958d7 100644 --- a/libs/data/src/lib/clan/clan-details/clan-details.service.ts +++ b/libs/data/src/lib/clan/clan-details/clan-details.service.ts @@ -5,7 +5,7 @@ import { map, take, catchError, mergeMap, switchMap } from 'rxjs/operators'; import { ClanDatabase } from '../clan-database'; import { of, from } from 'rxjs'; import { BaseClanService } from '../base-clan.service'; -import { StoreId } from '../../db/clan-indexed-db'; +import { ClanStoreId } from '@dcd/shared/utils/legacy-db'; import { clanDetailSerializer } from './clan-detail-serializer'; import { CLAN_LEVEL_HASH } from '../../hashes/clan-details'; @@ -15,7 +15,7 @@ export class ClanDetailsService extends BaseClanService { private rowId = 'ClanDetails'; constructor(private groupService: GroupV2Service, private clanDb: ClanDatabase) { - super(clanDb, StoreId.ClanDetails); + super(clanDb, ClanStoreId.ClanDetails); } private getClanDetailsFromAPI(clanId: string) { return this.groupService.groupV2GetGroup(clanId as unknown as number); diff --git a/libs/data/src/lib/clan/clan-member-activity/clan-member-activity.serializer.ts b/libs/data/src/lib/clan/clan-member-activity/clan-member-activity.serializer.ts index eed277bd..24988ed0 100644 --- a/libs/data/src/lib/clan/clan-member-activity/clan-member-activity.serializer.ts +++ b/libs/data/src/lib/clan/clan-member-activity/clan-member-activity.serializer.ts @@ -1,7 +1,6 @@ // import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from 'bungie-api-angular'; -import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from '../../models/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup'; - +import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from '@dcd/shared/models'; // import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from 'bungie-api-angular/lib/model/destinyHistoricalStatsDestinyHistoricalStatsPeriodGroup'; export function clanMemberActivitySerializer( diff --git a/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.serializer.ts b/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.serializer.ts index 78657ae3..af94902d 100644 --- a/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.serializer.ts +++ b/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.serializer.ts @@ -1,6 +1,6 @@ // import { MemberActivityStats, MemberActivityRecentStats, MemberActivityRecentStatsActivity } from 'bungie-models'; -import { MemberActivityRecentStats, MemberActivityRecentStatsActivity } from '../../models/MemberActivityRecentStats'; -import { MemberActivityStats } from '../../models/MemberActivityStat'; +import { MemberActivityRecentStats, MemberActivityRecentStatsActivity } from'@dcd/shared/models'; +import { MemberActivityStats } from '@dcd/shared/models'; // import { MemberActivityRecentStats } from 'projects/components/src/lib/clan-roster-activity-table/clan-roster-activity-table.component'; import { groupActivities } from '@destiny-clan-dashboard/shared/utils'; //import { getBungieStartDate } from '../../utility/date-utils'; diff --git a/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.service.ts b/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.service.ts index c03eb054..3adae022 100644 --- a/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.service.ts +++ b/libs/data/src/lib/clan/clan-member-recent-activity/clan-member-recent-activity.service.ts @@ -9,9 +9,9 @@ import { mergeMap, map, toArray } from 'rxjs/operators'; //import { MemberProfile } from 'projects/bungie-models/src/lib/models/MemberProfile'; //import { MemberActivityRecentStats } from 'projects/bungie-models/src/lib/models/MemberActivityRecentStats'; import { ClanDatabase } from '../clan-database'; -import { StoreId } from '../../db/clan-indexed-db'; +import { ClanStoreId } from '@dcd/shared/utils/legacy-db'; // import { MemberProfile } from '../../models'; -import { MemberActivityRecentStats } from '../../models/MemberActivityRecentStats'; +import { MemberActivityRecentStats } from '@dcd/shared/models'; import { clanMemberRecentActivitySerializer, TrackedDuration } from './clan-member-recent-activity.serializer'; interface MemberProfile { @@ -23,7 +23,7 @@ export class ClanMemberRecentActivityService extends BaseMemberActivityService { constructor(private clanDB: ClanDatabase, private baseApiKey: string) { super( clanDB, - StoreId.MemberRecentActivities, + ClanStoreId.MemberRecentActivities, baseApiKey, new Date(new Date().setDate(new Date().getDate() + ((2 + 7 - new Date().getDay()) % 7) - 90)), 8, diff --git a/libs/data/src/lib/clan/clan-members/clan-members.service.ts b/libs/data/src/lib/clan/clan-members/clan-members.service.ts index b53e9fb2..ae0fc770 100644 --- a/libs/data/src/lib/clan/clan-members/clan-members.service.ts +++ b/libs/data/src/lib/clan/clan-members/clan-members.service.ts @@ -3,7 +3,7 @@ import { Destiny2Service, GroupsV2GroupMember, GroupV2Service } from 'bungie-api //import { DBObject, StoreId } from '../app-indexed-db'; import { map, take, catchError, mergeMap, switchMap, shareReplay, concatMap } from 'rxjs/operators'; -import { StoreId } from '../../db/clan-indexed-db'; +import { ClanStoreId } from '@dcd/shared/utils/legacy-db'; import { ClanDatabase } from '../clan-database'; import { of, from, Observable } from 'rxjs'; import { BaseClanService } from '../base-clan.service'; @@ -13,7 +13,7 @@ import { ClanMembersServiceInterface } from './clan-members.interface'; export class ClanMembersService extends BaseClanService implements ClanMembersServiceInterface { private rowId = 'ClanMembers'; constructor(private groupService: GroupV2Service, private clanDb: ClanDatabase) { - super(clanDb, StoreId.ClanDetails); + super(clanDb, ClanStoreId.ClanDetails); } private getClanMembersFromAPI(clanId: string) { @@ -58,11 +58,11 @@ export class ClanMembersService extends BaseClanService implements ClanMembersSe ); } getClanMembersCachedSerialized(clanId: string): Observable { - // console.log(`getting-${clanId}`); + // console.log(`getting-${clanId}`); return from(this.getDataFromCache(clanId, this.rowId)) .pipe( map((x) => { - // console.log(`getting-done-${clanId}`); + // console.log(`getting-done-${clanId}`); return x?.data; }) ) diff --git a/libs/data/src/lib/clan/profiles/profile.service.ts b/libs/data/src/lib/clan/profiles/profile.service.ts index ff19be8a..e4667d13 100644 --- a/libs/data/src/lib/clan/profiles/profile.service.ts +++ b/libs/data/src/lib/clan/profiles/profile.service.ts @@ -5,9 +5,9 @@ import { Observable, from, of } from 'rxjs'; //import { StoreId } from '../app-indexed-db'; import { nowPlusDays, unixTimeStampToDate } from '@destiny-clan-dashboard/shared/utils'; -import { StoreId } from '../../db/clan-indexed-db'; +import { ClanStoreId } from '@dcd/shared/utils/legacy-db'; import { ClanDatabase } from '../clan-database'; -import { ClanMember } from '../../models/ClanMember'; +import { ClanMember } from '@dcd/shared/models'; import { ProfileService } from '../../profile/profile.service'; import { profileSerializer } from '../../profile/profile.serializer'; //import { MemberProfile } from '../../models/MemberProfile'; @@ -16,7 +16,7 @@ import { profileSerializer } from '../../profile/profile.serializer'; interface MemberProfile {} export class ClanProfileService extends ProfileService { - private tableName: StoreId = StoreId.MemberProfiles; + private tableName: ClanStoreId = ClanStoreId.MemberProfiles; private concurrentRequests = 20; // private profileComponents = [100, 104, 200, 202, 800, 900, 1100]; diff --git a/libs/data/src/lib/manifest/manifest-loader.service.ts b/libs/data/src/lib/manifest/manifest-loader.service.ts index c548e1e1..7a8f3295 100644 --- a/libs/data/src/lib/manifest/manifest-loader.service.ts +++ b/libs/data/src/lib/manifest/manifest-loader.service.ts @@ -3,7 +3,7 @@ import { Inject, Injectable } from '@angular/core'; import { Destiny2Service } from 'bungie-api-angular'; import { map, Observable, of, switchMap, take } from 'rxjs'; import { WindowToken } from '@dcd/shared/tokens'; -import { IdbKeyValService } from '../storage/idb-key-val.service'; +import { IdbKeyValService } from '@dcd/shared/utils/storage'; import { nowPlusMinutes } from '@destiny-clan-dashboard/shared/utils'; export const STATUS_EXTRACTING_TABLES = 'extracting tables'; diff --git a/libs/data/src/lib/models/Character.ts b/libs/data/src/lib/models/Character.ts deleted file mode 100644 index 958fe6a5..00000000 --- a/libs/data/src/lib/models/Character.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DestinyEntitiesCharactersDestinyCharacterComponent } from 'bungie-api-angular'; - -export interface Character extends DestinyEntitiesCharactersDestinyCharacterComponent {} diff --git a/libs/data/src/lib/models/ClanMemberSeasonPass.ts b/libs/data/src/lib/models/ClanMemberSeasonPass.ts deleted file mode 100644 index e5230116..00000000 --- a/libs/data/src/lib/models/ClanMemberSeasonPass.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { DestinyDestinyProgression } from 'bungie-api-angular'; - -export interface ClanMemberSeasonPassProgression { - progression: DestinyDestinyProgression; - prestigeProgression: DestinyDestinyProgression; -} diff --git a/libs/data/src/lib/models/CollectionDefinition.ts b/libs/data/src/lib/models/CollectionDefinition.ts deleted file mode 100644 index b25d86b1..00000000 --- a/libs/data/src/lib/models/CollectionDefinition.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DestinyDefinitionsCollectiblesDestinyCollectibleDefinition } from 'bungie-api-angular'; - -export interface CollectionDefinition extends DestinyDefinitionsCollectiblesDestinyCollectibleDefinition {} diff --git a/libs/data/src/lib/models/MemberActivityRecentStats.ts b/libs/data/src/lib/models/MemberActivityRecentStats.ts deleted file mode 100644 index 74fe4507..00000000 --- a/libs/data/src/lib/models/MemberActivityRecentStats.ts +++ /dev/null @@ -1,12 +0,0 @@ -// import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from 'bungie-api-angular'; -// interface MemberActivityStat extends DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup {} - -export interface MemberActivityRecentStats { - id: string; - activities: MemberActivityRecentStatsActivity[]; - trackedDates: { [key: string]: number }; -} -export interface MemberActivityRecentStatsActivity { - date: string | Date; - seconds: number; -} diff --git a/libs/data/src/lib/models/MemberProfile.ts b/libs/data/src/lib/models/MemberProfile.ts deleted file mode 100644 index f5ac5e1a..00000000 --- a/libs/data/src/lib/models/MemberProfile.ts +++ /dev/null @@ -1,51 +0,0 @@ - -// Local model to work with web workers -export interface MemberProfile { - id?: number; - - profile?: DestinyResponsesDestinyProfileResponseProfile; - profileProgression?: any; - profileRecords?: any; - profileCollectibles?: any; - metrics?: any; - profileCommendations?: any; - characters?: any; - - characterProgressions?: any; - characterRecords?: any; - characterCollectibles?: any; - -} -export interface DestinyResponsesDestinyProfileResponseProfile { - data?: DestinyEntitiesProfilesDestinyProfileComponent; - privacy?: number; - /** - * If true, this component is disabled. - */ - disabled?: boolean; -} -export interface DestinyEntitiesProfilesDestinyProfileComponent { - userInfo?: DestinyEntitiesProfilesDestinyProfileComponentUserInfo; - dateLastPlayed?: string; - versionsOwned?: number; - characterIds?: Array; - seasonHashes?: Array; - eventCardHashesOwned?: Array; - currentSeasonHash?: number; - currentSeasonRewardPowerCap?: number; - activeEventCardHash?: number; - currentGuardianRank?: number; - lifetimeHighestGuardianRank?: number; -} -export interface DestinyEntitiesProfilesDestinyProfileComponentUserInfo { - supplementalDisplayName?: string; - iconPath?: string; - crossSaveOverride?: number; - applicableMembershipTypes?: Array; - isPublic?: boolean; - membershipType?: number; - membershipId?: number; - displayName?: string; - bungieGlobalDisplayName?: string; - bungieGlobalDisplayNameCode?: number; -} diff --git a/libs/data/src/lib/models/RecordDefinition.ts b/libs/data/src/lib/models/RecordDefinition.ts deleted file mode 100644 index 8a5fe196..00000000 --- a/libs/data/src/lib/models/RecordDefinition.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DestinyDefinitionsRecordsDestinyRecordDefinition } from 'bungie-api-angular'; - -export interface RecordDefinition extends DestinyDefinitionsRecordsDestinyRecordDefinition {} diff --git a/libs/data/src/lib/models/SealDefinition.ts b/libs/data/src/lib/models/SealDefinition.ts deleted file mode 100644 index 47df9154..00000000 --- a/libs/data/src/lib/models/SealDefinition.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { DestinyDefinitionsPresentationDestinyPresentationNodeDefinition } from "bungie-api-angular"; - -export interface SealDefinition extends DestinyDefinitionsPresentationDestinyPresentationNodeDefinition {} diff --git a/libs/data/src/lib/models/__mocks__/bungie-info.ts b/libs/data/src/lib/models/__mocks__/bungie-info.ts deleted file mode 100644 index c26249be..00000000 --- a/libs/data/src/lib/models/__mocks__/bungie-info.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { BungieInfo } from '../BungieInfo'; - -const getFakeBungieInfo = (override?: Partial): BungieInfo => { - return { - membershipId:'', - uniqueName:'', - displayName:'', - - }; -}; diff --git a/libs/data/src/lib/models/__mocks__/index.ts b/libs/data/src/lib/models/__mocks__/index.ts deleted file mode 100644 index 7e1a213e..00000000 --- a/libs/data/src/lib/models/__mocks__/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './public-api'; diff --git a/libs/data/src/lib/models/__mocks__/public-api.ts b/libs/data/src/lib/models/__mocks__/public-api.ts deleted file mode 100644 index 1d496e6d..00000000 --- a/libs/data/src/lib/models/__mocks__/public-api.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './seal-definition.mock'; -export * from './clan-details'; diff --git a/libs/data/src/lib/models/enums/index.ts b/libs/data/src/lib/models/enums/index.ts deleted file mode 100644 index 48b75244..00000000 --- a/libs/data/src/lib/models/enums/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './MembershipTypes'; diff --git a/libs/data/src/lib/models/enums/public-api.ts b/libs/data/src/lib/models/enums/public-api.ts deleted file mode 100644 index ea465c2a..00000000 --- a/libs/data/src/lib/models/enums/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './index'; diff --git a/libs/data/src/lib/models/index.ts b/libs/data/src/lib/models/index.ts deleted file mode 100644 index d393e771..00000000 --- a/libs/data/src/lib/models/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export * from './ActivityStats'; -export * from './BungieInfo'; -export * from './ClanDetails'; -export * from './ClanMember'; -export * from './CollectionDefinition'; -export * from './MemberProfile'; -export * from './DeepPartial'; -export * from './enums'; -export * from './SealDefinition'; -export * from './MetricDefinition'; -export * from './RecordDefinition'; -export * from './DestinyActivityModeType'; -export * from './DestinyActivityModeCategory'; diff --git a/libs/data/src/lib/models/public-api.ts b/libs/data/src/lib/models/public-api.ts deleted file mode 100644 index ea465c2a..00000000 --- a/libs/data/src/lib/models/public-api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './index'; diff --git a/libs/data/src/lib/profile/cached-profile.service.ts b/libs/data/src/lib/profile/cached-profile.service.ts index 9d7bc7b2..a40fe4e1 100644 --- a/libs/data/src/lib/profile/cached-profile.service.ts +++ b/libs/data/src/lib/profile/cached-profile.service.ts @@ -1,11 +1,10 @@ import { Injectable } from '@angular/core'; import { createStore, UseStore } from 'idb-keyval'; import { catchError, from, map, mergeMap, Observable, of } from 'rxjs'; -import { IdbKeyValService } from '../storage'; +import { IdbKeyValService } from '@dcd/shared/utils/storage'; import { nowPlusDays, unixTimeStampToDate } from '@destiny-clan-dashboard/shared/utils'; import { ProfileService } from './profile.service'; -import { MemberProfile } from '../models/MemberProfile'; - +import { MemberProfile } from '@dcd/shared/models'; export class CachedProfileService extends ProfileService { profileStore: UseStore; constructor(private idbKeyValService: IdbKeyValService, private apiKey: string) { diff --git a/libs/data/src/lib/profile/profile.service.ts b/libs/data/src/lib/profile/profile.service.ts index 8978cc8c..42273102 100644 --- a/libs/data/src/lib/profile/profile.service.ts +++ b/libs/data/src/lib/profile/profile.service.ts @@ -1,5 +1,5 @@ import { from, mergeMap, Observable } from 'rxjs'; -import { ClanMember } from '../models/ClanMember'; +import { ClanMember } from '@dcd/shared/models'; export class ProfileService { // 100 Profiles // 104 Profile Progression diff --git a/libs/data/src/lib/stat-aggregators/clan-activity.service.ts b/libs/data/src/lib/stat-aggregators/clan-activity.service.ts index fba455b0..4641dd97 100644 --- a/libs/data/src/lib/stat-aggregators/clan-activity.service.ts +++ b/libs/data/src/lib/stat-aggregators/clan-activity.service.ts @@ -4,7 +4,7 @@ import { map, mergeMap, toArray } from 'rxjs/operators'; import { ClanDatabase } from '../clan/clan-database'; import { TrackedDuration } from '../clan/clan-member-recent-activity/clan-member-recent-activity.serializer'; import { ClanMemberRecentActivityService } from '../clan/clan-member-recent-activity/clan-member-recent-activity.service'; -import { ActivityStats } from '../models/ActivityStats'; + import { ActivityStats } from '@dcd/shared/models'; // import { ActivityStats } from '../models'; // import { ClanDatabase, ClanMemberRecentActivityService } from '../clan-db'; diff --git a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.spec.ts b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.spec.ts index e795daf7..db4922b2 100644 --- a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.spec.ts +++ b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.spec.ts @@ -4,7 +4,7 @@ // import { of } from 'rxjs'; import { ClanDatabase } from '../../clan/clan-database'; -import { MemberActivityTime } from '../../models/MemberActivityTime'; +import { MemberActivityTime } from '@dcd/shared/models'; import { BaseClanAggregateTimeService } from './base-clan-aggregate-time.service'; // import { ClanDatabase, ClanMemberRecentActivityService, } from '../../clan-db'; diff --git a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.ts b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.ts index 6b769eaf..0c3b6aa0 100644 --- a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.ts +++ b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/base-clan-aggregate-time.service.ts @@ -8,7 +8,7 @@ import { map, mergeMap } from 'rxjs/operators'; import { ClanDatabase } from '../../clan/clan-database'; import { ClanMemberRecentActivityService } from '../../clan/clan-member-recent-activity/clan-member-recent-activity.service'; // import { MemberProfile } from '../../models/MemberProfile'; -import { MemberActivityTime } from '../../models/MemberActivityTime'; +import { MemberActivityTime } from '@dcd/shared/models'; // import { AppConfig } from 'src/app/app.config'; // import { ClanMemberRecentActivityService } from '../../clan-db/clan-member-recent-activity/clan-member-recent-activity.service'; // import { ClanDatabase } from '../../clan-db/ClanDatabase'; diff --git a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/daily-clan-aggregate-time.service.ts b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/daily-clan-aggregate-time.service.ts index 5b7ec096..5f0efc24 100644 --- a/libs/data/src/lib/stat-aggregators/clan-aggregate-time/daily-clan-aggregate-time.service.ts +++ b/libs/data/src/lib/stat-aggregators/clan-aggregate-time/daily-clan-aggregate-time.service.ts @@ -3,7 +3,7 @@ //import { forkJoin, from, Observable } from 'rxjs'; //import { map, mergeMap, toArray } from 'rxjs/operators'; // import { MemberActivityTime } from 'projects/bungie-models/src/lib/models/MemberActivityTime'; -import { MemberActivityTime } from '../../models/MemberActivityTime'; +import { MemberActivityTime } from '@dcd/shared/models'; import { nowPlusDays } from '@destiny-clan-dashboard/shared/utils'; import { groupActivityStatsByDate } from '@destiny-clan-dashboard/shared/utils'; import { BaseClanAggregateTimeService } from './base-clan-aggregate-time.service'; diff --git a/libs/data/src/lib/storage/index.ts b/libs/data/src/lib/storage/index.ts deleted file mode 100644 index 7e1a213e..00000000 --- a/libs/data/src/lib/storage/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './public-api'; diff --git a/libs/data/src/lib/storage/public-api.ts b/libs/data/src/lib/storage/public-api.ts deleted file mode 100644 index a0bb5350..00000000 --- a/libs/data/src/lib/storage/public-api.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './idb-key-val.service'; -export * from './local-storage.service'; diff --git a/libs/dcd/activities/breakdown-list/src/lib/activity-breakdown-list.component.ts b/libs/dcd/activities/breakdown-list/src/lib/activity-breakdown-list.component.ts index d74f0daa..6295ce67 100644 --- a/libs/dcd/activities/breakdown-list/src/lib/activity-breakdown-list.component.ts +++ b/libs/dcd/activities/breakdown-list/src/lib/activity-breakdown-list.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; -import { CollectionDefinition, MetricDefinition, RecordDefinition } from '@destiny-clan-dashboard/data/models'; +import { CollectionDefinition, MetricDefinition, RecordDefinition } from '@dcd/shared/models'; //import { ActivitiesService } from '../data-access/activities.service'; import { ActivitiesService } from '@dcd/activities/data-access'; import { Observable, map, of, startWith, tap } from 'rxjs'; diff --git a/libs/dcd/activities/table/src/lib/activity-table.component.ts b/libs/dcd/activities/table/src/lib/activity-table.component.ts index d29804b3..109bd612 100644 --- a/libs/dcd/activities/table/src/lib/activity-table.component.ts +++ b/libs/dcd/activities/table/src/lib/activity-table.component.ts @@ -8,7 +8,7 @@ import { Viewer, ViewerMetadata } from '@destiny-clan-dashboard/shared/data'; -import { CollectionDefinition, MetricDefinition, RecordDefinition } from '@destiny-clan-dashboard/data/models'; +import { CollectionDefinition, MetricDefinition, RecordDefinition } from '@dcd/shared/models'; import { ClanMemberProfile } from '@dcd/shared/models'; import { filter, map, Observable, of, startWith, switchMap, tap } from 'rxjs'; import { ActivitiesService } from '@dcd/activities/data-access'; diff --git a/libs/dcd/activity-modes/data-access/src/lib/activity-mode.service.ts b/libs/dcd/activity-modes/data-access/src/lib/activity-mode.service.ts index 07391f9b..e6570018 100644 --- a/libs/dcd/activity-modes/data-access/src/lib/activity-mode.service.ts +++ b/libs/dcd/activity-modes/data-access/src/lib/activity-mode.service.ts @@ -1,4 +1,4 @@ -import { DESTINY_ACTIVITY_MODES } from '@destiny-clan-dashboard/data/models'; +import { DESTINY_ACTIVITY_MODES } from '@dcd/shared/models'; import { DefinitionService } from '@dcd/shared/data-access/definitions'; import { Injectable } from '@angular/core'; import { of, switchMap } from 'rxjs'; diff --git a/libs/dcd/activity-modes/models/src/lib/ProfileActivityMode.ts b/libs/dcd/activity-modes/models/src/lib/ProfileActivityMode.ts index a6507172..ddcd7345 100644 --- a/libs/dcd/activity-modes/models/src/lib/ProfileActivityMode.ts +++ b/libs/dcd/activity-modes/models/src/lib/ProfileActivityMode.ts @@ -1,6 +1,7 @@ -import { ActivityStats, MemberActivityRecentStats, MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { GroupsV2GroupMember } from 'bungie-api-angular/lib/model/groupsV2GroupMember'; // import { GroupsV2GroupMember } from 'bungie-api-angular'; +import { MemberActivityRecentStats } from '@dcd/shared/models'; export interface ProfileRecentActivity { clan: { diff --git a/libs/dcd/clans-roster/clans-roster-list/src/lib/clan-roster-metadata/ClanRosterViewer.ts b/libs/dcd/clans-roster/clans-roster-list/src/lib/clan-roster-metadata/ClanRosterViewer.ts index 46d4e732..de773ac1 100644 --- a/libs/dcd/clans-roster/clans-roster-list/src/lib/clan-roster-metadata/ClanRosterViewer.ts +++ b/libs/dcd/clans-roster/clans-roster-list/src/lib/clan-roster-metadata/ClanRosterViewer.ts @@ -3,7 +3,7 @@ import { ViewerMetadata } from '@destiny-clan-dashboard/shared/data'; // import { MemberTypeComponent } from '@destiny-clan-dashboard/components/icons'; import { MemberTypeComponent } from '@dcd/shared/ui/icons'; import { ClassCellComponent } from '../../../../ui/src/lib/class-cell/class-cell.component'; -import { MembershipTypes } from '@destiny-clan-dashboard/data/models'; +import { MembershipTypes } from '@dcd/shared/models'; import { ClanRosterItem } from '@dcd/clans-roster/models'; import { ProfileLinkComponent } from '@dcd/shared/ui/profile-link'; import { BungieDatePipe, BungieDateTimePipe } from '@dcd/shared/utils/pipes'; diff --git a/libs/dcd/clans-roster/data-access/src/lib/clans-roster.service.ts b/libs/dcd/clans-roster/data-access/src/lib/clans-roster.service.ts index 6716153b..925d5da2 100644 --- a/libs/dcd/clans-roster/data-access/src/lib/clans-roster.service.ts +++ b/libs/dcd/clans-roster/data-access/src/lib/clans-roster.service.ts @@ -10,7 +10,7 @@ import { selectAllClansMembersProfiles, selectClanMemberProfileStateLoading } fr import { ClanMemberProfile } from '@dcd/shared/models'; import { ClanBungieInfoService } from 'libs/data/src/lib/clan/bungie-info/bungie-info.service'; import { ClanRosterItem } from '@dcd/clans-roster/models'; -import { BungieInfo } from '@destiny-clan-dashboard/data/models'; +import { BungieInfo } from '@dcd/shared/models'; @Injectable() export class ClansRosterService { diff --git a/libs/dcd/clans-roster/models/src/lib/ClanRosterItem.ts b/libs/dcd/clans-roster/models/src/lib/ClanRosterItem.ts index 417bf07f..aee202f8 100644 --- a/libs/dcd/clans-roster/models/src/lib/ClanRosterItem.ts +++ b/libs/dcd/clans-roster/models/src/lib/ClanRosterItem.ts @@ -1,4 +1,4 @@ -import { BungieInfo } from '@destiny-clan-dashboard/data/models'; +import { BungieInfo } from '@dcd/shared/models'; import { ClanMemberProfile } from '@dcd/shared/models'; export interface ClanRosterItem extends ClanMemberProfile{ diff --git a/libs/dcd/clans-roster/ui/src/lib/class-cell/class-cell.component.ts b/libs/dcd/clans-roster/ui/src/lib/class-cell/class-cell.component.ts index 041d870a..fc312c71 100644 --- a/libs/dcd/clans-roster/ui/src/lib/class-cell/class-cell.component.ts +++ b/libs/dcd/clans-roster/ui/src/lib/class-cell/class-cell.component.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, Input, Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from'@dcd/shared/models'; @Pipe({ name: 'classicon', pure: true, diff --git a/libs/dcd/player/overview/src/lib/player-overview.component.ts b/libs/dcd/player/overview/src/lib/player-overview.component.ts index b6b5fdb2..51d224a7 100644 --- a/libs/dcd/player/overview/src/lib/player-overview.component.ts +++ b/libs/dcd/player/overview/src/lib/player-overview.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { BehaviorSubject, filter, map, Observable, switchMap, tap } from 'rxjs'; import { PlayerService } from '@dcd/player/data-access'; import { BungieInfoService } from 'libs/data/src/lib/profile/bungie-info.service'; -import { BungieInfo } from '@destiny-clan-dashboard/data/models'; +import { BungieInfo } from '@dcd/shared/models'; import { convertSealAndProfile } from '@dcd/shared/ui/member'; import { GlobalSealsService } from '@dcd/shared/data-access/seals'; import { DefinitionService } from '@dcd/shared/data-access/definitions'; diff --git a/libs/dcd/player/shell/src/lib/player-shell.module.ts b/libs/dcd/player/shell/src/lib/player-shell.module.ts index 942a3705..ffae639b 100644 --- a/libs/dcd/player/shell/src/lib/player-shell.module.ts +++ b/libs/dcd/player/shell/src/lib/player-shell.module.ts @@ -5,7 +5,7 @@ import { PlayerShellRoutingModule } from './player-shell-routing.module'; import { PlayerDetailModule } from '@dcd/player/detail'; import { CachedProfileService } from '@destiny-clan-dashboard/data/profile'; //import { environment } from '../../../../environments/environment'; -import { IdbKeyValService } from '@destiny-clan-dashboard/data/storage'; +import { IdbKeyValService } from '@dcd/shared/utils/storage'; // import { PlayerService } from '../data-access/player.service'; import { PlayerService } from '@dcd/player/data-access'; import { AppConfigService } from '@dcd/shared/utils/app-config'; diff --git a/libs/dcd/player/ui/src/lib/member-overview/member-overview.component.ts b/libs/dcd/player/ui/src/lib/member-overview/member-overview.component.ts index 653f0e76..f725aa10 100644 --- a/libs/dcd/player/ui/src/lib/member-overview/member-overview.component.ts +++ b/libs/dcd/player/ui/src/lib/member-overview/member-overview.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { MatCardModule } from '@angular/material/card'; import { BungieDateTimePipe } from '@dcd/shared/utils/pipes'; import { @@ -10,8 +10,8 @@ import { BungieInfoComponent } from '@dcd/shared/ui/member'; -import { Character } from 'libs/data/src/lib/models/Character'; -import { ClanMemberSeasonPassProgression } from 'libs/data/src/lib/models/ClanMemberSeasonPass'; +import { Character } from '@dcd/shared/models'; +import { ClanMemberSeasonPassProgression } from '@dcd/shared/models'; import { SeasonService } from '@dcd/shared/data-access/definitions'; // import { Observable } from 'rxjs'; // import { GlobalSealsService } from '@core/services/global-seals.service'; diff --git a/libs/dcd/roster-recent-activity/dashboard/src/lib/recent-activity-metadata/RecentActivityExporter.ts b/libs/dcd/roster-recent-activity/dashboard/src/lib/recent-activity-metadata/RecentActivityExporter.ts index 49390d1d..8085415c 100644 --- a/libs/dcd/roster-recent-activity/dashboard/src/lib/recent-activity-metadata/RecentActivityExporter.ts +++ b/libs/dcd/roster-recent-activity/dashboard/src/lib/recent-activity-metadata/RecentActivityExporter.ts @@ -1,4 +1,3 @@ -import { MembershipTypes } from '@destiny-clan-dashboard/data/models/enums'; import { ProfileRecentActivity } from '@dcd/roster-recent-activity/models'; import { PlaytimePipe } from '@dcd/shared/utils/pipes'; import { BungieDateTimePipe } from '@dcd/shared/utils/pipes'; diff --git a/libs/dcd/roster-recent-activity/models/src/lib/profile-recent-activity.ts b/libs/dcd/roster-recent-activity/models/src/lib/profile-recent-activity.ts index 12c8b6b4..f48c49b1 100644 --- a/libs/dcd/roster-recent-activity/models/src/lib/profile-recent-activity.ts +++ b/libs/dcd/roster-recent-activity/models/src/lib/profile-recent-activity.ts @@ -1,5 +1,6 @@ -import { ActivityStats, MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { GroupsV2GroupMember } from 'bungie-api-angular/lib/model/groupsV2GroupMember'; +import { ActivityStats } from '@dcd/shared/models'; //import { GroupsV2GroupMember } from 'bungie-api-angular/'; export interface ProfileRecentActivity { diff --git a/libs/dcd/seals/data-access/src/lib/seals.service.ts b/libs/dcd/seals/data-access/src/lib/seals.service.ts index 8102bec6..4080a89b 100644 --- a/libs/dcd/seals/data-access/src/lib/seals.service.ts +++ b/libs/dcd/seals/data-access/src/lib/seals.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; // import { RecordDefin itionService } from '@core/definition-services/record-definition.service'; import { SeasonService, DefinitionService } from '@dcd/shared/data-access/definitions'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { getClanMemberId, getMemberProfileId } from '@destiny-clan-dashboard/shared/utils'; import { ClanProfileService } from 'libs/data/src/lib/clan/profiles/profile.service'; import { profileSerializer } from 'libs/data/src/lib/profile/profile.serializer'; diff --git a/libs/dcd/shared/data-access/store/src/lib/clans-members-profiles/clan-members-profiles.selectors.ts b/libs/dcd/shared/data-access/store/src/lib/clans-members-profiles/clan-members-profiles.selectors.ts index 7faf3b5b..ccae80d8 100644 --- a/libs/dcd/shared/data-access/store/src/lib/clans-members-profiles/clan-members-profiles.selectors.ts +++ b/libs/dcd/shared/data-access/store/src/lib/clans-members-profiles/clan-members-profiles.selectors.ts @@ -5,7 +5,7 @@ import { createSelector, createFeatureSelector } from '@ngrx/store'; //import { selectAllClansWithMembersProfiles } from '../clans-with-members-profiles/clans-with-members-profiles.selectors'; import { ClanMemberProfile } from '@dcd/shared/models'; import { getClanMemberId, getMemberProfileId } from '@destiny-clan-dashboard/shared/utils'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { selectAllClansWithMembers } from '../clans-with-members'; import { selectAllClansWithMembersProfiles } from '../clans-with-members-profiles'; diff --git a/libs/dcd/shared/data-access/store/src/lib/clans-with-members-profiles/clans-with-members-profiles.state.ts b/libs/dcd/shared/data-access/store/src/lib/clans-with-members-profiles/clans-with-members-profiles.state.ts index 0d31d360..a57393f8 100644 --- a/libs/dcd/shared/data-access/store/src/lib/clans-with-members-profiles/clans-with-members-profiles.state.ts +++ b/libs/dcd/shared/data-access/store/src/lib/clans-with-members-profiles/clans-with-members-profiles.state.ts @@ -2,7 +2,7 @@ import { AppState } from '../core.state'; import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity'; // import { ClanConfig } from '../../../../../../../libs/dcd/shared/data-access/store/src/lib/clans/clans.state'; import { GroupsV2GroupMember } from 'bungie-api-angular/lib/model/groupsV2GroupMember'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { ClanConfig } from '@dcd/shared/models'; export interface ClanWithMembersAndProfiles { diff --git a/libs/dcd/shared/mocks/src/lib/Character.ts b/libs/dcd/shared/mocks/src/lib/Character.ts index 292487ac..69593970 100644 --- a/libs/dcd/shared/mocks/src/lib/Character.ts +++ b/libs/dcd/shared/mocks/src/lib/Character.ts @@ -1,4 +1,4 @@ -import { Character } from 'projects/data/src/lib/models/Character'; +import { Character } from '@dcd/shared/models'; export const MOCK_CHARACTER: Character = { membershipId: 4611686018470541488, membershipType: 1, diff --git a/libs/data/src/lib/models/__mocks__/activity-definition.ts b/libs/dcd/shared/mocks/src/lib/activity-definition.ts similarity index 100% rename from libs/data/src/lib/models/__mocks__/activity-definition.ts rename to libs/dcd/shared/mocks/src/lib/activity-definition.ts diff --git a/libs/dcd/shared/mocks/src/lib/bungie-info.ts b/libs/dcd/shared/mocks/src/lib/bungie-info.ts new file mode 100644 index 00000000..b718248e --- /dev/null +++ b/libs/dcd/shared/mocks/src/lib/bungie-info.ts @@ -0,0 +1,10 @@ +// import { BungieInfo } from '../BungieInfo'; +import { BungieInfo } from '@dcd/shared/models'; + +const getFakeBungieInfo = (override?: Partial): BungieInfo => { + return { + membershipId: '', + uniqueName: '', + displayName: '' + }; +}; diff --git a/libs/data/src/lib/models/__mocks__/clan-details.ts b/libs/dcd/shared/mocks/src/lib/clan-details.ts similarity index 95% rename from libs/data/src/lib/models/__mocks__/clan-details.ts rename to libs/dcd/shared/mocks/src/lib/clan-details.ts index 6f41d97a..ebefc2cd 100644 --- a/libs/data/src/lib/models/__mocks__/clan-details.ts +++ b/libs/dcd/shared/mocks/src/lib/clan-details.ts @@ -1,5 +1,4 @@ -import { GroupsV2GroupV2 } from 'bungie-api-angular/lib/model/groupsV2GroupV2'; -import { ClanDetails } from '../ClanDetails'; +import { ClanDetails } from '@dcd/shared/models'; export const getMockClan = (overrideClan: Partial): ClanDetails => { return { diff --git a/libs/data/src/lib/models/__mocks__/seal-definition.mock.ts b/libs/dcd/shared/mocks/src/lib/seal-definition.mock.ts similarity index 97% rename from libs/data/src/lib/models/__mocks__/seal-definition.mock.ts rename to libs/dcd/shared/mocks/src/lib/seal-definition.mock.ts index b4b6d44e..91d1681f 100644 --- a/libs/data/src/lib/models/__mocks__/seal-definition.mock.ts +++ b/libs/dcd/shared/mocks/src/lib/seal-definition.mock.ts @@ -1,5 +1,4 @@ -import { SealDefinition } from "../SealDefinition"; - +import { SealDefinition } from '@dcd/shared/models'; export const MOCK_SEAL_DEFINITION: SealDefinition = { displayProperties: { description: 'Complete Event Challenges during the Festival of the Lost. Progress resets at the end of the event.', @@ -67,5 +66,5 @@ export const MOCK_SEAL_DEFINITION: SealDefinition = { parentNodeHashes: [616318467], hash: 2592822840, index: 1319, - redacted: false, + redacted: false }; diff --git a/libs/dcd/shared/models/src/index.ts b/libs/dcd/shared/models/src/index.ts index 4d52f70b..e295c945 100644 --- a/libs/dcd/shared/models/src/index.ts +++ b/libs/dcd/shared/models/src/index.ts @@ -1,6 +1,23 @@ +export * from './lib/ActivityStats' +export * from './lib/BungieInfo'; +export * from './lib/Character'; export * from './lib/ClanConfig'; export * from './lib/ClanConfigMembers'; +export * from './lib/ClanDetails'; +export * from './lib/ClanMember'; export * from './lib/ClanMemberSeasonPass'; export * from './lib/MemberProfile'; export * from './lib/SealDefinition'; export * from './lib/ClanMemberProfile'; +export * from './lib/DeepPartial'; +export * from './lib/DestinyActivityModeCategory'; +export * from './lib/DestinyActivityModeType'; +export * from './lib/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup'; +// export * from './lib/MemberActivityRecentStats'; +export * from './lib/MemberActivityStat'; +export * from './lib/MemberActivityTime'; +export * from './lib/MetricDefinition'; +export * from './lib/RecordDefinition'; +export * from './lib/time'; +export * from './lib/enums/MembershipTypes'; +export * from './lib/CollectionDefinition'; diff --git a/libs/data/src/lib/models/ActivityStats.ts b/libs/dcd/shared/models/src/lib/ActivityStats.ts similarity index 100% rename from libs/data/src/lib/models/ActivityStats.ts rename to libs/dcd/shared/models/src/lib/ActivityStats.ts diff --git a/libs/data/src/lib/models/BungieInfo.ts b/libs/dcd/shared/models/src/lib/BungieInfo.ts similarity index 100% rename from libs/data/src/lib/models/BungieInfo.ts rename to libs/dcd/shared/models/src/lib/BungieInfo.ts diff --git a/libs/dcd/shared/models/src/lib/Character.ts b/libs/dcd/shared/models/src/lib/Character.ts new file mode 100644 index 00000000..eabfbdd8 --- /dev/null +++ b/libs/dcd/shared/models/src/lib/Character.ts @@ -0,0 +1,5 @@ +// import { DestinyEntitiesCharactersDestinyCharacterComponent } from 'bungie-api-angular'; + +import { DestinyEntitiesCharactersDestinyCharacterComponent } from "bungie-api-angular/lib/model/destinyEntitiesCharactersDestinyCharacterComponent"; + +export interface Character extends DestinyEntitiesCharactersDestinyCharacterComponent {} diff --git a/libs/data/src/lib/models/ClanDetails.ts b/libs/dcd/shared/models/src/lib/ClanDetails.ts similarity index 100% rename from libs/data/src/lib/models/ClanDetails.ts rename to libs/dcd/shared/models/src/lib/ClanDetails.ts diff --git a/libs/data/src/lib/models/ClanMember.ts b/libs/dcd/shared/models/src/lib/ClanMember.ts similarity index 100% rename from libs/data/src/lib/models/ClanMember.ts rename to libs/dcd/shared/models/src/lib/ClanMember.ts diff --git a/libs/dcd/shared/models/src/lib/ClanMemberProfile.ts b/libs/dcd/shared/models/src/lib/ClanMemberProfile.ts index fe0f0676..2e1609e0 100644 --- a/libs/dcd/shared/models/src/lib/ClanMemberProfile.ts +++ b/libs/dcd/shared/models/src/lib/ClanMemberProfile.ts @@ -1,4 +1,4 @@ -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { GroupsV2GroupMember } from 'bungie-api-angular/lib/model/groupsV2GroupMember'; export interface ClanMemberProfile { diff --git a/libs/dcd/shared/models/src/lib/CollectionDefinition.ts b/libs/dcd/shared/models/src/lib/CollectionDefinition.ts new file mode 100644 index 00000000..2fed1d4a --- /dev/null +++ b/libs/dcd/shared/models/src/lib/CollectionDefinition.ts @@ -0,0 +1,5 @@ +/// import { DestinyDefinitionsCollectiblesDestinyCollectibleDefinition } from 'bungie-api-angular'; + +import { DestinyDefinitionsCollectiblesDestinyCollectibleDefinition } from "bungie-api-angular/lib/model/destinyDefinitionsCollectiblesDestinyCollectibleDefinition"; + +export interface CollectionDefinition extends DestinyDefinitionsCollectiblesDestinyCollectibleDefinition {} diff --git a/libs/data/src/lib/models/DeepPartial.ts b/libs/dcd/shared/models/src/lib/DeepPartial.ts similarity index 100% rename from libs/data/src/lib/models/DeepPartial.ts rename to libs/dcd/shared/models/src/lib/DeepPartial.ts diff --git a/libs/data/src/lib/models/DestinyActivityModeCategory.ts b/libs/dcd/shared/models/src/lib/DestinyActivityModeCategory.ts similarity index 100% rename from libs/data/src/lib/models/DestinyActivityModeCategory.ts rename to libs/dcd/shared/models/src/lib/DestinyActivityModeCategory.ts diff --git a/libs/data/src/lib/models/DestinyActivityModeType.ts b/libs/dcd/shared/models/src/lib/DestinyActivityModeType.ts similarity index 100% rename from libs/data/src/lib/models/DestinyActivityModeType.ts rename to libs/dcd/shared/models/src/lib/DestinyActivityModeType.ts diff --git a/libs/data/src/lib/models/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup.ts b/libs/dcd/shared/models/src/lib/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup.ts similarity index 100% rename from libs/data/src/lib/models/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup.ts rename to libs/dcd/shared/models/src/lib/DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup.ts diff --git a/libs/dcd/shared/models/src/lib/MemberActivityRecentStats.ts b/libs/dcd/shared/models/src/lib/MemberActivityRecentStats.ts new file mode 100644 index 00000000..8c71db65 --- /dev/null +++ b/libs/dcd/shared/models/src/lib/MemberActivityRecentStats.ts @@ -0,0 +1,12 @@ +// import { DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup } from 'bungie-api-angular'; +// interface MemberActivityStat extends DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup {} + +// export interface MemberActivityRecentStats { +// id: string; +// activities: MemberActivityRecentStatsActivity[]; +// trackedDates: { [key: string]: number }; +// } +// export interface MemberActivityRecentStatsActivity { +// date: string | Date; +// seconds: number; +// } diff --git a/libs/data/src/lib/models/MemberActivityStat.ts b/libs/dcd/shared/models/src/lib/MemberActivityStat.ts similarity index 76% rename from libs/data/src/lib/models/MemberActivityStat.ts rename to libs/dcd/shared/models/src/lib/MemberActivityStat.ts index 1beacd15..1f5a52b9 100644 --- a/libs/data/src/lib/models/MemberActivityStat.ts +++ b/libs/dcd/shared/models/src/lib/MemberActivityStat.ts @@ -1,3 +1,5 @@ +import { DestinyHistoricalStatsDestinyHistoricalStatsValuePair } from "./DestinyHistoricalStatsDestinyHistoricalStatsPeriodGroup"; + export interface MemberActivityStat { period?: string; @@ -28,7 +30,7 @@ interface DestinyHistoricalStatsDestinyHistoricalStatsValue { weighted?: DestinyHistoricalStatsDestinyHistoricalStatsValuePair; activityId?: number; } -export interface DestinyHistoricalStatsDestinyHistoricalStatsValuePair { - value?: number; - displayValue?: string; -} +// export interface DestinyHistoricalStatsDestinyHistoricalStatsValuePair { +// value?: number; +// displayValue?: string; +// } diff --git a/libs/data/src/lib/models/MemberActivityTime.ts b/libs/dcd/shared/models/src/lib/MemberActivityTime.ts similarity index 100% rename from libs/data/src/lib/models/MemberActivityTime.ts rename to libs/dcd/shared/models/src/lib/MemberActivityTime.ts diff --git a/libs/data/src/lib/models/MetricDefinition.ts b/libs/dcd/shared/models/src/lib/MetricDefinition.ts similarity index 100% rename from libs/data/src/lib/models/MetricDefinition.ts rename to libs/dcd/shared/models/src/lib/MetricDefinition.ts diff --git a/libs/dcd/shared/models/src/lib/RecordDefinition.ts b/libs/dcd/shared/models/src/lib/RecordDefinition.ts new file mode 100644 index 00000000..92bcd010 --- /dev/null +++ b/libs/dcd/shared/models/src/lib/RecordDefinition.ts @@ -0,0 +1,5 @@ +// import { DestinyDefinitionsRecordsDestinyRecordDefinition } from 'bungie-api-angular'; + +import { DestinyDefinitionsRecordsDestinyRecordDefinition } from "bungie-api-angular/lib/model/destinyDefinitionsRecordsDestinyRecordDefinition"; + +export interface RecordDefinition extends DestinyDefinitionsRecordsDestinyRecordDefinition {} diff --git a/libs/data/src/lib/models/enums/MembershipTypes.ts b/libs/dcd/shared/models/src/lib/enums/MembershipTypes.ts similarity index 100% rename from libs/data/src/lib/models/enums/MembershipTypes.ts rename to libs/dcd/shared/models/src/lib/enums/MembershipTypes.ts diff --git a/libs/data/src/lib/models/time.ts b/libs/dcd/shared/models/src/lib/time.ts similarity index 100% rename from libs/data/src/lib/models/time.ts rename to libs/dcd/shared/models/src/lib/time.ts diff --git a/libs/dcd/shared/ui/member/src/lib/bungie-info/bungie-info.component.ts b/libs/dcd/shared/ui/member/src/lib/bungie-info/bungie-info.component.ts index a6a7e05a..ea116d9b 100644 --- a/libs/dcd/shared/ui/member/src/lib/bungie-info/bungie-info.component.ts +++ b/libs/dcd/shared/ui/member/src/lib/bungie-info/bungie-info.component.ts @@ -3,7 +3,7 @@ import { NgFor, NgIf } from '@angular/common'; import { MatCardModule } from '@angular/material/card'; import { MatListModule } from '@angular/material/list'; import { MatIconModule } from '@angular/material/icon'; -import { BungieInfo } from '@destiny-clan-dashboard/data/models'; +import { BungieInfo } from '@dcd/shared/models'; import { BungieDatePipe, DateAgoPipe } from '@dcd/shared/utils/pipes'; @Component({ diff --git a/libs/dcd/shared/ui/member/src/lib/character-card/character-card.component.ts b/libs/dcd/shared/ui/member/src/lib/character-card/character-card.component.ts index 68ec561c..1b224a25 100644 --- a/libs/dcd/shared/ui/member/src/lib/character-card/character-card.component.ts +++ b/libs/dcd/shared/ui/member/src/lib/character-card/character-card.component.ts @@ -2,7 +2,7 @@ import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; import { CommonModule, NgIf } from '@angular/common'; import { MatCardModule } from '@angular/material/card'; import { ClassTypeTextPipe, RaceTypeTextPipe } from '@dcd/shared/utils/pipes'; -import { Character } from 'libs/data/src/lib/models/Character'; +import { Character } from '@dcd/shared/models'; @Component({ selector: 'lib-character-card', diff --git a/libs/dcd/shared/ui/member/src/lib/player-seals/member-profile.converter.ts b/libs/dcd/shared/ui/member/src/lib/player-seals/member-profile.converter.ts index 1f6e89a0..89f2c980 100644 --- a/libs/dcd/shared/ui/member/src/lib/player-seals/member-profile.converter.ts +++ b/libs/dcd/shared/ui/member/src/lib/player-seals/member-profile.converter.ts @@ -1,4 +1,4 @@ -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { PlayerSeal } from './player-seal'; import { DestinyDefinitionsPresentationDestinyPresentationNodeDefinition } from 'bungie-api-angular/lib/model/destinyDefinitionsPresentationDestinyPresentationNodeDefinition'; import { DefinitionService } from '@dcd/shared/data-access/definitions'; diff --git a/libs/dcd/shared/ui/profile-link/src/lib/profile-link.component.ts b/libs/dcd/shared/ui/profile-link/src/lib/profile-link.component.ts index c07a403b..62441390 100644 --- a/libs/dcd/shared/ui/profile-link/src/lib/profile-link.component.ts +++ b/libs/dcd/shared/ui/profile-link/src/lib/profile-link.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { BungieDisplayNamePipe } from '@dcd/shared/utils/pipes'; import { RouterModule } from '@angular/router'; @Component({ diff --git a/libs/dcd/shared/utils/legacy-db/.eslintrc.json b/libs/dcd/shared/utils/legacy-db/.eslintrc.json new file mode 100644 index 00000000..9014cab6 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "dcd", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "dcd", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/libs/dcd/shared/utils/legacy-db/README.md b/libs/dcd/shared/utils/legacy-db/README.md new file mode 100644 index 00000000..546c855d --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/README.md @@ -0,0 +1,7 @@ +# shared-utils-legacy-db + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test shared-utils-legacy-db` to execute the unit tests. diff --git a/libs/dcd/shared/utils/legacy-db/jest.config.ts b/libs/dcd/shared/utils/legacy-db/jest.config.ts new file mode 100644 index 00000000..f28fcbae --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'shared-utils-legacy-db', + preset: '../../../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../../../coverage/libs/dcd/shared/utils/legacy-db', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$' + } + ] + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment' + ] +}; diff --git a/libs/dcd/shared/utils/legacy-db/project.json b/libs/dcd/shared/utils/legacy-db/project.json new file mode 100644 index 00000000..00fbe426 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/project.json @@ -0,0 +1,20 @@ +{ + "name": "shared-utils-legacy-db", + "$schema": "../../../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/dcd/shared/utils/legacy-db/src", + "prefix": "dcd", + "tags": ["type:util"], + "projectType": "library", + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/dcd/shared/utils/legacy-db/jest.config.ts" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/libs/dcd/shared/utils/legacy-db/src/index.ts b/libs/dcd/shared/utils/legacy-db/src/index.ts new file mode 100644 index 00000000..3523c9b2 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/src/index.ts @@ -0,0 +1,3 @@ +export { AppIndexedDb } from './lib/app-indexed-db'; +// export * from './lib/base-indexed-db'; +export { AppIndexedDb as ClanIndexedDb, StoreId as ClanStoreId, DBObject as ClanDbObject, STORE_IDS as CLAN_STORE_IDS } from './lib/clan-indexed-db'; diff --git a/libs/data/src/lib/db/app-indexed-db.ts b/libs/dcd/shared/utils/legacy-db/src/lib/app-indexed-db.ts similarity index 100% rename from libs/data/src/lib/db/app-indexed-db.ts rename to libs/dcd/shared/utils/legacy-db/src/lib/app-indexed-db.ts diff --git a/libs/data/src/lib/db/base-indexed-db.ts b/libs/dcd/shared/utils/legacy-db/src/lib/base-indexed-db.ts similarity index 100% rename from libs/data/src/lib/db/base-indexed-db.ts rename to libs/dcd/shared/utils/legacy-db/src/lib/base-indexed-db.ts diff --git a/libs/data/src/lib/db/clan-indexed-db.ts b/libs/dcd/shared/utils/legacy-db/src/lib/clan-indexed-db.ts similarity index 100% rename from libs/data/src/lib/db/clan-indexed-db.ts rename to libs/dcd/shared/utils/legacy-db/src/lib/clan-indexed-db.ts diff --git a/libs/dcd/shared/utils/legacy-db/src/test-setup.ts b/libs/dcd/shared/utils/legacy-db/src/test-setup.ts new file mode 100644 index 00000000..d99945d0 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true + } +}; +import 'jest-preset-angular/setup-jest'; diff --git a/libs/dcd/shared/utils/legacy-db/tsconfig.json b/libs/dcd/shared/utils/legacy-db/tsconfig.json new file mode 100644 index 00000000..0ba12d47 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../../../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/libs/dcd/shared/utils/legacy-db/tsconfig.lib.json b/libs/dcd/shared/utils/legacy-db/tsconfig.lib.json new file mode 100644 index 00000000..389a4ad3 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/libs/dcd/shared/utils/legacy-db/tsconfig.spec.json b/libs/dcd/shared/utils/legacy-db/tsconfig.spec.json new file mode 100644 index 00000000..92278312 --- /dev/null +++ b/libs/dcd/shared/utils/legacy-db/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/libs/dcd/shared/utils/pipes/src/lib/bungie-display-name/bungie-display-name.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/bungie-display-name/bungie-display-name.pipe.ts index ef7a0cb5..dfb186eb 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/bungie-display-name/bungie-display-name.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/bungie-display-name/bungie-display-name.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; import { getBungieDisplayName } from '@destiny-clan-dashboard/shared/utils'; @Pipe({ diff --git a/libs/dcd/shared/utils/pipes/src/lib/bungie-profile-url/bungie-profile-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/bungie-profile-url/bungie-profile-url.pipe.ts index 2b6996e7..7a741c41 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/bungie-profile-url/bungie-profile-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/bungie-profile-url/bungie-profile-url.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'bungieProfileUrl', diff --git a/libs/dcd/shared/utils/pipes/src/lib/d2-checklist-url/d2-checklist-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/d2-checklist-url/d2-checklist-url.pipe.ts index 0471d951..6e525d86 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/d2-checklist-url/d2-checklist-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/d2-checklist-url/d2-checklist-url.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'd2ChecklistUrl', diff --git a/libs/dcd/shared/utils/pipes/src/lib/destiny-tracker-url/destiny-tracker-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/destiny-tracker-url/destiny-tracker-url.pipe.ts index ee6a5ee7..58742ea9 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/destiny-tracker-url/destiny-tracker-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/destiny-tracker-url/destiny-tracker-url.pipe.ts @@ -1,7 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; -import { MembershipTypes } from '@destiny-clan-dashboard/data/models/enums'; - +import { MemberProfile } from '@dcd/shared/models'; +import { MembershipTypes } from '@dcd/shared/models'; @Pipe({ name: 'destinyTrackerUrl', standalone: true diff --git a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/base-dungeon-report.ts b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/base-dungeon-report.ts index 7207d936..7995af30 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/base-dungeon-report.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/base-dungeon-report.ts @@ -1,4 +1,4 @@ -import { MembershipTypes } from "@destiny-clan-dashboard/data/models/enums"; +import { MembershipTypes } from '@dcd/shared/models';; const baseUrl = 'https://dungeon.report'; const getPSUrl = (displayName: string) => { diff --git a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-profile-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-profile-url.pipe.ts index e2a5ead8..6cf679c2 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-profile-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-profile-url.pipe.ts @@ -1,7 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { getDungeonReportUrl } from './base-dungeon-report'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; - +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'dungeonReportProfileUrl', standalone: true diff --git a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-url.pipe.ts index ef803624..be8790bc 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/dungeon-report-url/dungeon-report-url.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { getDungeonReportUrl } from './base-dungeon-report'; -import { ClanMember } from '@destiny-clan-dashboard/data/models'; +import { ClanMember } from '@dcd/shared/models'; @Pipe({ name: 'dungeonReportUrl', diff --git a/libs/dcd/shared/utils/pipes/src/lib/in-collections/in-collections-total.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/in-collections/in-collections-total.pipe.ts index 8ca2a629..e3093843 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/in-collections/in-collections-total.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/in-collections/in-collections-total.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { hasItem } from './has-item'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'inCollectionsTotal', diff --git a/libs/dcd/shared/utils/pipes/src/lib/member-type/member-type.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/member-type/member-type.pipe.ts index 1045d4c3..2f5e64e6 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/member-type/member-type.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/member-type/member-type.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MembershipTypes } from '@destiny-clan-dashboard/data/models/enums'; +import { MembershipTypes } from '@dcd/shared/models'; @Pipe({ name: 'memberType', diff --git a/libs/dcd/shared/utils/pipes/src/lib/metric-total/metric-total.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/metric-total/metric-total.pipe.ts index d061fa56..6c2f4c60 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/metric-total/metric-total.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/metric-total/metric-total.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'metricTotal', diff --git a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.pipe.ts index f929f59c..969f5f8c 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { ClanMember, MembershipTypes } from '@destiny-clan-dashboard/data/models'; +import { ClanMember, MembershipTypes } from '@dcd/shared/models'; // import { ClanMember } from 'bungie-models'; // import { MembershipTypes } from '@destiny-clan-dashboard/models/enums'; diff --git a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.ts b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.ts index f58880a8..971e2f0c 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/base-raid-report-url.ts @@ -1,4 +1,4 @@ -import { MembershipTypes } from "@destiny-clan-dashboard/data/models"; +import { MembershipTypes } from '@dcd/shared/models'; const baseUrl = 'https://raid.report'; const getPSUrl = (displayName: string) => { diff --git a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-profile-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-profile-url.pipe.ts index aa209782..294bd5bd 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-profile-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-profile-url.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { getRaidReportUrl } from './base-raid-report-url'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'raidReportProfileUrl', diff --git a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-url.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-url.pipe.ts index 0e5cd3f2..dce8a027 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-url.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/raid-report-url/raid-report-url.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { getRaidReportUrl } from './base-raid-report-url'; -import { ClanMember } from '@destiny-clan-dashboard/data/models'; +import { ClanMember } from '@dcd/shared/models'; @Pipe({ name: 'raidReportUrl', diff --git a/libs/dcd/shared/utils/pipes/src/lib/record-total/record-total.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/record-total/record-total.pipe.ts index 74fc828f..212ecfb0 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/record-total/record-total.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/record-total/record-total.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile, RecordDefinition } from '@destiny-clan-dashboard/data/models'; +import { MemberProfile, RecordDefinition } from '@dcd/shared/models'; import { hasCompleted } from './has-completed'; @Pipe({ diff --git a/libs/dcd/shared/utils/pipes/src/lib/triumph-report/triumph-report.pipe.ts b/libs/dcd/shared/utils/pipes/src/lib/triumph-report/triumph-report.pipe.ts index 69a44c31..db807995 100644 --- a/libs/dcd/shared/utils/pipes/src/lib/triumph-report/triumph-report.pipe.ts +++ b/libs/dcd/shared/utils/pipes/src/lib/triumph-report/triumph-report.pipe.ts @@ -1,6 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { MemberProfile } from '@destiny-clan-dashboard/data/models'; - +import { MemberProfile } from '@dcd/shared/models'; @Pipe({ name: 'triumphReport', standalone: true diff --git a/libs/dcd/shared/utils/storage/.eslintrc.json b/libs/dcd/shared/utils/storage/.eslintrc.json new file mode 100644 index 00000000..9014cab6 --- /dev/null +++ b/libs/dcd/shared/utils/storage/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "dcd", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "dcd", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/libs/dcd/shared/utils/storage/README.md b/libs/dcd/shared/utils/storage/README.md new file mode 100644 index 00000000..1b97e046 --- /dev/null +++ b/libs/dcd/shared/utils/storage/README.md @@ -0,0 +1,7 @@ +# shared-utils-storage + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test shared-utils-storage` to execute the unit tests. diff --git a/libs/dcd/shared/utils/storage/jest.config.ts b/libs/dcd/shared/utils/storage/jest.config.ts new file mode 100644 index 00000000..df195a33 --- /dev/null +++ b/libs/dcd/shared/utils/storage/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'shared-utils-storage', + preset: '../../../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../../../coverage/libs/dcd/shared/utils/storage', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$' + } + ] + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment' + ] +}; diff --git a/libs/dcd/shared/utils/storage/project.json b/libs/dcd/shared/utils/storage/project.json new file mode 100644 index 00000000..4786b6b0 --- /dev/null +++ b/libs/dcd/shared/utils/storage/project.json @@ -0,0 +1,20 @@ +{ + "name": "shared-utils-storage", + "$schema": "../../../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/dcd/shared/utils/storage/src", + "prefix": "dcd", + "tags": ["type:util"], + "projectType": "library", + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/dcd/shared/utils/storage/jest.config.ts" + } + }, + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/libs/dcd/shared/utils/storage/src/index.ts b/libs/dcd/shared/utils/storage/src/index.ts new file mode 100644 index 00000000..cc08648c --- /dev/null +++ b/libs/dcd/shared/utils/storage/src/index.ts @@ -0,0 +1,2 @@ +export * from './lib/idb-key-val.service'; +export * from './lib/local-storage.service'; diff --git a/libs/data/src/lib/storage/datastore.interface.ts b/libs/dcd/shared/utils/storage/src/lib/datastore.interface.ts similarity index 100% rename from libs/data/src/lib/storage/datastore.interface.ts rename to libs/dcd/shared/utils/storage/src/lib/datastore.interface.ts diff --git a/libs/data/src/lib/storage/idb-key-val.service.spec.ts b/libs/dcd/shared/utils/storage/src/lib/idb-key-val.service.spec.ts similarity index 100% rename from libs/data/src/lib/storage/idb-key-val.service.spec.ts rename to libs/dcd/shared/utils/storage/src/lib/idb-key-val.service.spec.ts diff --git a/libs/data/src/lib/storage/idb-key-val.service.ts b/libs/dcd/shared/utils/storage/src/lib/idb-key-val.service.ts similarity index 100% rename from libs/data/src/lib/storage/idb-key-val.service.ts rename to libs/dcd/shared/utils/storage/src/lib/idb-key-val.service.ts diff --git a/libs/data/src/lib/storage/local-storage.service.spec.ts b/libs/dcd/shared/utils/storage/src/lib/local-storage.service.spec.ts similarity index 100% rename from libs/data/src/lib/storage/local-storage.service.spec.ts rename to libs/dcd/shared/utils/storage/src/lib/local-storage.service.spec.ts diff --git a/libs/data/src/lib/storage/local-storage.service.ts b/libs/dcd/shared/utils/storage/src/lib/local-storage.service.ts similarity index 100% rename from libs/data/src/lib/storage/local-storage.service.ts rename to libs/dcd/shared/utils/storage/src/lib/local-storage.service.ts diff --git a/libs/dcd/shared/utils/storage/src/test-setup.ts b/libs/dcd/shared/utils/storage/src/test-setup.ts new file mode 100644 index 00000000..d99945d0 --- /dev/null +++ b/libs/dcd/shared/utils/storage/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true + } +}; +import 'jest-preset-angular/setup-jest'; diff --git a/libs/dcd/shared/utils/storage/tsconfig.json b/libs/dcd/shared/utils/storage/tsconfig.json new file mode 100644 index 00000000..0ba12d47 --- /dev/null +++ b/libs/dcd/shared/utils/storage/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../../../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/libs/dcd/shared/utils/storage/tsconfig.lib.json b/libs/dcd/shared/utils/storage/tsconfig.lib.json new file mode 100644 index 00000000..389a4ad3 --- /dev/null +++ b/libs/dcd/shared/utils/storage/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/libs/dcd/shared/utils/storage/tsconfig.spec.json b/libs/dcd/shared/utils/storage/tsconfig.spec.json new file mode 100644 index 00000000..92278312 --- /dev/null +++ b/libs/dcd/shared/utils/storage/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 028afca8..678289d4 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -88,8 +88,10 @@ "@dcd/shared/utils/api-key-interceptor": ["libs/dcd/shared/utils/api-key-interceptor/src/index.ts"], "@dcd/shared/utils/app-config": ["libs/dcd/shared/utils/app-config/src/index.ts"], "@dcd/shared/utils/directives": ["libs/dcd/shared/utils/directives/src/index.ts"], + "@dcd/shared/utils/legacy-db": ["libs/dcd/shared/utils/legacy-db/src/index.ts"], "@dcd/shared/utils/local-storage": ["libs/dcd/shared/utils/local-storage/src/index.ts"], "@dcd/shared/utils/pipes": ["libs/dcd/shared/utils/pipes/src/index.ts"], + "@dcd/shared/utils/storage": ["libs/dcd/shared/utils/storage/src/index.ts"], "@destiny-clan-dashboard/clan-search/data-access": ["libs/dcd/clan-search/data-access/src/index.ts"], "@destiny-clan-dashboard/clan-search/feature/clan-search-curated-view": [ "libs/dcd/clan-search/feature/clan-search-curated-view/src/index.ts"