Some ignored filles was missing
This commit is contained in:
parent
7db22245e2
commit
fd5ab6bc0d
268 changed files with 31970 additions and 4 deletions
39
wwwroot/js/repositories/ApiEventRepository.d.ts
vendored
Normal file
39
wwwroot/js/repositories/ApiEventRepository.d.ts
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { ICalendarEvent } from '../types/CalendarTypes';
|
||||
import { Configuration } from '../configurations/CalendarConfig';
|
||||
/**
|
||||
* ApiEventRepository
|
||||
* Handles communication with backend API
|
||||
*
|
||||
* Used by SyncManager to send queued operations to the server
|
||||
* NOT used directly by EventManager (which uses IndexedDBEventRepository)
|
||||
*
|
||||
* Future enhancements:
|
||||
* - SignalR real-time updates
|
||||
* - Conflict resolution
|
||||
* - Batch operations
|
||||
*/
|
||||
export declare class ApiEventRepository {
|
||||
private apiEndpoint;
|
||||
constructor(config: Configuration);
|
||||
/**
|
||||
* Send create operation to API
|
||||
*/
|
||||
sendCreate(event: ICalendarEvent): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Send update operation to API
|
||||
*/
|
||||
sendUpdate(id: string, updates: Partial<ICalendarEvent>): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Send delete operation to API
|
||||
*/
|
||||
sendDelete(id: string): Promise<void>;
|
||||
/**
|
||||
* Fetch all events from API
|
||||
*/
|
||||
fetchAll(): Promise<ICalendarEvent[]>;
|
||||
/**
|
||||
* Initialize SignalR connection
|
||||
* Placeholder for future implementation
|
||||
*/
|
||||
initializeSignalR(): Promise<void>;
|
||||
}
|
||||
115
wwwroot/js/repositories/ApiEventRepository.js
Normal file
115
wwwroot/js/repositories/ApiEventRepository.js
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* ApiEventRepository
|
||||
* Handles communication with backend API
|
||||
*
|
||||
* Used by SyncManager to send queued operations to the server
|
||||
* NOT used directly by EventManager (which uses IndexedDBEventRepository)
|
||||
*
|
||||
* Future enhancements:
|
||||
* - SignalR real-time updates
|
||||
* - Conflict resolution
|
||||
* - Batch operations
|
||||
*/
|
||||
export class ApiEventRepository {
|
||||
constructor(config) {
|
||||
this.apiEndpoint = config.apiEndpoint;
|
||||
}
|
||||
/**
|
||||
* Send create operation to API
|
||||
*/
|
||||
async sendCreate(event) {
|
||||
// TODO: Implement API call
|
||||
// const response = await fetch(`${this.apiEndpoint}/events`, {
|
||||
// method: 'POST',
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// body: JSON.stringify(event)
|
||||
// });
|
||||
//
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`API create failed: ${response.statusText}`);
|
||||
// }
|
||||
//
|
||||
// return await response.json();
|
||||
throw new Error('ApiEventRepository.sendCreate not implemented yet');
|
||||
}
|
||||
/**
|
||||
* Send update operation to API
|
||||
*/
|
||||
async sendUpdate(id, updates) {
|
||||
// TODO: Implement API call
|
||||
// const response = await fetch(`${this.apiEndpoint}/events/${id}`, {
|
||||
// method: 'PATCH',
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// body: JSON.stringify(updates)
|
||||
// });
|
||||
//
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`API update failed: ${response.statusText}`);
|
||||
// }
|
||||
//
|
||||
// return await response.json();
|
||||
throw new Error('ApiEventRepository.sendUpdate not implemented yet');
|
||||
}
|
||||
/**
|
||||
* Send delete operation to API
|
||||
*/
|
||||
async sendDelete(id) {
|
||||
// TODO: Implement API call
|
||||
// const response = await fetch(`${this.apiEndpoint}/events/${id}`, {
|
||||
// method: 'DELETE'
|
||||
// });
|
||||
//
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`API delete failed: ${response.statusText}`);
|
||||
// }
|
||||
throw new Error('ApiEventRepository.sendDelete not implemented yet');
|
||||
}
|
||||
/**
|
||||
* Fetch all events from API
|
||||
*/
|
||||
async fetchAll() {
|
||||
// TODO: Implement API call
|
||||
// const response = await fetch(`${this.apiEndpoint}/events`);
|
||||
//
|
||||
// if (!response.ok) {
|
||||
// throw new Error(`API fetch failed: ${response.statusText}`);
|
||||
// }
|
||||
//
|
||||
// return await response.json();
|
||||
throw new Error('ApiEventRepository.fetchAll not implemented yet');
|
||||
}
|
||||
// ========================================
|
||||
// Future: SignalR Integration
|
||||
// ========================================
|
||||
/**
|
||||
* Initialize SignalR connection
|
||||
* Placeholder for future implementation
|
||||
*/
|
||||
async initializeSignalR() {
|
||||
// TODO: Setup SignalR connection
|
||||
// - Connect to hub
|
||||
// - Register event handlers
|
||||
// - Handle reconnection
|
||||
//
|
||||
// Example:
|
||||
// const connection = new signalR.HubConnectionBuilder()
|
||||
// .withUrl(`${this.apiEndpoint}/hubs/calendar`)
|
||||
// .build();
|
||||
//
|
||||
// connection.on('EventCreated', (event: ICalendarEvent) => {
|
||||
// // Handle remote create
|
||||
// });
|
||||
//
|
||||
// connection.on('EventUpdated', (event: ICalendarEvent) => {
|
||||
// // Handle remote update
|
||||
// });
|
||||
//
|
||||
// connection.on('EventDeleted', (eventId: string) => {
|
||||
// // Handle remote delete
|
||||
// });
|
||||
//
|
||||
// await connection.start();
|
||||
throw new Error('SignalR not implemented yet');
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ApiEventRepository.js.map
|
||||
1
wwwroot/js/repositories/ApiEventRepository.js.map
Normal file
1
wwwroot/js/repositories/ApiEventRepository.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ApiEventRepository.js","sourceRoot":"","sources":["../../../src/repositories/ApiEventRepository.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,kBAAkB;IAG7B,YAAY,MAAqB;QAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,KAAqB;QACpC,2BAA2B;QAC3B,+DAA+D;QAC/D,oBAAoB;QACpB,qDAAqD;QACrD,gCAAgC;QAChC,MAAM;QACN,EAAE;QACF,sBAAsB;QACtB,kEAAkE;QAClE,IAAI;QACJ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CAAC;IACjD,CAAC;CACF"}
|
||||
51
wwwroot/js/repositories/IEventRepository.d.ts
vendored
Normal file
51
wwwroot/js/repositories/IEventRepository.d.ts
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { ICalendarEvent } from '../types/CalendarTypes';
|
||||
/**
|
||||
* Update source type
|
||||
* - 'local': Changes made by the user locally (needs sync)
|
||||
* - 'remote': Changes from API/SignalR (already synced)
|
||||
*/
|
||||
export type UpdateSource = 'local' | 'remote';
|
||||
/**
|
||||
* IEventRepository - Interface for event data access
|
||||
*
|
||||
* Abstracts the data source for calendar events, allowing easy switching
|
||||
* between IndexedDB, REST API, GraphQL, or other data sources.
|
||||
*
|
||||
* Implementations:
|
||||
* - IndexedDBEventRepository: Local storage with offline support
|
||||
* - MockEventRepository: (Legacy) Loads from local JSON file
|
||||
* - ApiEventRepository: (Future) Loads from backend API
|
||||
*/
|
||||
export interface IEventRepository {
|
||||
/**
|
||||
* Load all calendar events from the data source
|
||||
* @returns Promise resolving to array of ICalendarEvent objects
|
||||
* @throws Error if loading fails
|
||||
*/
|
||||
loadEvents(): Promise<ICalendarEvent[]>;
|
||||
/**
|
||||
* Create a new event
|
||||
* @param event - Event to create (without ID, will be generated)
|
||||
* @param source - Source of the update ('local' or 'remote')
|
||||
* @returns Promise resolving to the created event with generated ID
|
||||
* @throws Error if creation fails
|
||||
*/
|
||||
createEvent(event: Omit<ICalendarEvent, 'id'>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Update an existing event
|
||||
* @param id - ID of the event to update
|
||||
* @param updates - Partial event data to update
|
||||
* @param source - Source of the update ('local' or 'remote')
|
||||
* @returns Promise resolving to the updated event
|
||||
* @throws Error if update fails or event not found
|
||||
*/
|
||||
updateEvent(id: string, updates: Partial<ICalendarEvent>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Delete an event
|
||||
* @param id - ID of the event to delete
|
||||
* @param source - Source of the update ('local' or 'remote')
|
||||
* @returns Promise resolving when deletion is complete
|
||||
* @throws Error if deletion fails or event not found
|
||||
*/
|
||||
deleteEvent(id: string, source?: UpdateSource): Promise<void>;
|
||||
}
|
||||
2
wwwroot/js/repositories/IEventRepository.js
Normal file
2
wwwroot/js/repositories/IEventRepository.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=IEventRepository.js.map
|
||||
1
wwwroot/js/repositories/IEventRepository.js.map
Normal file
1
wwwroot/js/repositories/IEventRepository.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"IEventRepository.js","sourceRoot":"","sources":["../../../src/repositories/IEventRepository.ts"],"names":[],"mappings":""}
|
||||
47
wwwroot/js/repositories/IndexedDBEventRepository.d.ts
vendored
Normal file
47
wwwroot/js/repositories/IndexedDBEventRepository.d.ts
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { ICalendarEvent } from '../types/CalendarTypes';
|
||||
import { IEventRepository, UpdateSource } from './IEventRepository';
|
||||
import { IndexedDBService } from '../storage/IndexedDBService';
|
||||
import { OperationQueue } from '../storage/OperationQueue';
|
||||
/**
|
||||
* IndexedDBEventRepository
|
||||
* Offline-first repository using IndexedDB as single source of truth
|
||||
*
|
||||
* All CRUD operations:
|
||||
* - Save to IndexedDB immediately (always succeeds)
|
||||
* - Add to sync queue if source is 'local'
|
||||
* - Background SyncManager processes queue to sync with API
|
||||
*/
|
||||
export declare class IndexedDBEventRepository implements IEventRepository {
|
||||
private indexedDB;
|
||||
private queue;
|
||||
constructor(indexedDB: IndexedDBService, queue: OperationQueue);
|
||||
/**
|
||||
* Load all events from IndexedDB
|
||||
* Ensures IndexedDB is initialized and seeded on first call
|
||||
*/
|
||||
loadEvents(): Promise<ICalendarEvent[]>;
|
||||
/**
|
||||
* Create a new event
|
||||
* - Generates ID
|
||||
* - Saves to IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
createEvent(event: Omit<ICalendarEvent, 'id'>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Update an existing event
|
||||
* - Updates in IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
updateEvent(id: string, updates: Partial<ICalendarEvent>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* Delete an event
|
||||
* - Removes from IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
deleteEvent(id: string, source?: UpdateSource): Promise<void>;
|
||||
/**
|
||||
* Generate unique event ID
|
||||
* Format: {timestamp}-{random}
|
||||
*/
|
||||
private generateEventId;
|
||||
}
|
||||
127
wwwroot/js/repositories/IndexedDBEventRepository.js
Normal file
127
wwwroot/js/repositories/IndexedDBEventRepository.js
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/**
|
||||
* IndexedDBEventRepository
|
||||
* Offline-first repository using IndexedDB as single source of truth
|
||||
*
|
||||
* All CRUD operations:
|
||||
* - Save to IndexedDB immediately (always succeeds)
|
||||
* - Add to sync queue if source is 'local'
|
||||
* - Background SyncManager processes queue to sync with API
|
||||
*/
|
||||
export class IndexedDBEventRepository {
|
||||
constructor(indexedDB, queue) {
|
||||
this.indexedDB = indexedDB;
|
||||
this.queue = queue;
|
||||
}
|
||||
/**
|
||||
* Load all events from IndexedDB
|
||||
* Ensures IndexedDB is initialized and seeded on first call
|
||||
*/
|
||||
async loadEvents() {
|
||||
// Lazy initialization on first data load
|
||||
if (!this.indexedDB.isInitialized()) {
|
||||
await this.indexedDB.initialize();
|
||||
await this.indexedDB.seedIfEmpty();
|
||||
}
|
||||
return await this.indexedDB.getAllEvents();
|
||||
}
|
||||
/**
|
||||
* Create a new event
|
||||
* - Generates ID
|
||||
* - Saves to IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
async createEvent(event, source = 'local') {
|
||||
// Generate unique ID
|
||||
const id = this.generateEventId();
|
||||
// Determine sync status based on source
|
||||
const syncStatus = source === 'local' ? 'pending' : 'synced';
|
||||
// Create full event object
|
||||
const newEvent = {
|
||||
...event,
|
||||
id,
|
||||
syncStatus
|
||||
};
|
||||
// Save to IndexedDB
|
||||
await this.indexedDB.saveEvent(newEvent);
|
||||
// If local change, add to sync queue
|
||||
if (source === 'local') {
|
||||
await this.queue.enqueue({
|
||||
type: 'create',
|
||||
eventId: id,
|
||||
data: newEvent,
|
||||
timestamp: Date.now(),
|
||||
retryCount: 0
|
||||
});
|
||||
}
|
||||
return newEvent;
|
||||
}
|
||||
/**
|
||||
* Update an existing event
|
||||
* - Updates in IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
async updateEvent(id, updates, source = 'local') {
|
||||
// Get existing event
|
||||
const existingEvent = await this.indexedDB.getEvent(id);
|
||||
if (!existingEvent) {
|
||||
throw new Error(`Event with ID ${id} not found`);
|
||||
}
|
||||
// Determine sync status based on source
|
||||
const syncStatus = source === 'local' ? 'pending' : 'synced';
|
||||
// Merge updates
|
||||
const updatedEvent = {
|
||||
...existingEvent,
|
||||
...updates,
|
||||
id, // Ensure ID doesn't change
|
||||
syncStatus
|
||||
};
|
||||
// Save to IndexedDB
|
||||
await this.indexedDB.saveEvent(updatedEvent);
|
||||
// If local change, add to sync queue
|
||||
if (source === 'local') {
|
||||
await this.queue.enqueue({
|
||||
type: 'update',
|
||||
eventId: id,
|
||||
data: updates,
|
||||
timestamp: Date.now(),
|
||||
retryCount: 0
|
||||
});
|
||||
}
|
||||
return updatedEvent;
|
||||
}
|
||||
/**
|
||||
* Delete an event
|
||||
* - Removes from IndexedDB
|
||||
* - Adds to queue if local (needs sync)
|
||||
*/
|
||||
async deleteEvent(id, source = 'local') {
|
||||
// Check if event exists
|
||||
const existingEvent = await this.indexedDB.getEvent(id);
|
||||
if (!existingEvent) {
|
||||
throw new Error(`Event with ID ${id} not found`);
|
||||
}
|
||||
// If local change, add to sync queue BEFORE deleting
|
||||
// (so we can send the delete operation to API later)
|
||||
if (source === 'local') {
|
||||
await this.queue.enqueue({
|
||||
type: 'delete',
|
||||
eventId: id,
|
||||
data: {}, // No data needed for delete
|
||||
timestamp: Date.now(),
|
||||
retryCount: 0
|
||||
});
|
||||
}
|
||||
// Delete from IndexedDB
|
||||
await this.indexedDB.deleteEvent(id);
|
||||
}
|
||||
/**
|
||||
* Generate unique event ID
|
||||
* Format: {timestamp}-{random}
|
||||
*/
|
||||
generateEventId() {
|
||||
const timestamp = Date.now();
|
||||
const random = Math.random().toString(36).substring(2, 9);
|
||||
return `${timestamp}-${random}`;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=IndexedDBEventRepository.js.map
|
||||
1
wwwroot/js/repositories/IndexedDBEventRepository.js.map
Normal file
1
wwwroot/js/repositories/IndexedDBEventRepository.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"IndexedDBEventRepository.js","sourceRoot":"","sources":["../../../src/repositories/IndexedDBEventRepository.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,MAAM,OAAO,wBAAwB;IAInC,YAAY,SAA2B,EAAE,KAAqB;QAC5D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,yCAAyC;QACzC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,KAAiC,EAAE,SAAuB,OAAO;QACjF,qBAAqB;QACrB,MAAM,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAElC,wCAAwC;QACxC,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wwroot/js/repositories/MockEventRepository.d.ts
vendored
Normal file
33
wwwroot/js/repositories/MockEventRepository.d.ts
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { ICalendarEvent } from '../types/CalendarTypes';
|
||||
import { IEventRepository, UpdateSource } from './IEventRepository';
|
||||
/**
|
||||
* MockEventRepository - Loads event data from local JSON file (LEGACY)
|
||||
*
|
||||
* This repository implementation fetches mock event data from a static JSON file.
|
||||
* DEPRECATED: Use IndexedDBEventRepository for offline-first functionality.
|
||||
*
|
||||
* Data Source: data/mock-events.json
|
||||
*
|
||||
* NOTE: Create/Update/Delete operations are not supported - throws errors.
|
||||
* This is intentional to encourage migration to IndexedDBEventRepository.
|
||||
*/
|
||||
export declare class MockEventRepository implements IEventRepository {
|
||||
private readonly dataUrl;
|
||||
loadEvents(): Promise<ICalendarEvent[]>;
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
createEvent(event: Omit<ICalendarEvent, 'id'>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
updateEvent(id: string, updates: Partial<ICalendarEvent>, source?: UpdateSource): Promise<ICalendarEvent>;
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
deleteEvent(id: string, source?: UpdateSource): Promise<void>;
|
||||
private processCalendarData;
|
||||
}
|
||||
62
wwwroot/js/repositories/MockEventRepository.js
Normal file
62
wwwroot/js/repositories/MockEventRepository.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* MockEventRepository - Loads event data from local JSON file (LEGACY)
|
||||
*
|
||||
* This repository implementation fetches mock event data from a static JSON file.
|
||||
* DEPRECATED: Use IndexedDBEventRepository for offline-first functionality.
|
||||
*
|
||||
* Data Source: data/mock-events.json
|
||||
*
|
||||
* NOTE: Create/Update/Delete operations are not supported - throws errors.
|
||||
* This is intentional to encourage migration to IndexedDBEventRepository.
|
||||
*/
|
||||
export class MockEventRepository {
|
||||
constructor() {
|
||||
this.dataUrl = 'data/mock-events.json';
|
||||
}
|
||||
async loadEvents() {
|
||||
try {
|
||||
const response = await fetch(this.dataUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to load mock events: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
const rawData = await response.json();
|
||||
return this.processCalendarData(rawData);
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Failed to load event data:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
async createEvent(event, source) {
|
||||
throw new Error('MockEventRepository does not support createEvent. Use IndexedDBEventRepository instead.');
|
||||
}
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
async updateEvent(id, updates, source) {
|
||||
throw new Error('MockEventRepository does not support updateEvent. Use IndexedDBEventRepository instead.');
|
||||
}
|
||||
/**
|
||||
* NOT SUPPORTED - MockEventRepository is read-only
|
||||
* Use IndexedDBEventRepository instead
|
||||
*/
|
||||
async deleteEvent(id, source) {
|
||||
throw new Error('MockEventRepository does not support deleteEvent. Use IndexedDBEventRepository instead.');
|
||||
}
|
||||
processCalendarData(data) {
|
||||
return data.map((event) => ({
|
||||
...event,
|
||||
start: new Date(event.start),
|
||||
end: new Date(event.end),
|
||||
type: event.type,
|
||||
allDay: event.allDay || false,
|
||||
syncStatus: 'synced'
|
||||
}));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=MockEventRepository.js.map
|
||||
1
wwwroot/js/repositories/MockEventRepository.js.map
Normal file
1
wwwroot/js/repositories/MockEventRepository.js.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version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